the well seems to getting deeper and deeper...
> arrays cannot be assigned.
so, this means the :
is itself wrong ?
but, we can assign one pointer to another and use the other pointer for referencing data for normal variables.. The array we have is a set of pointers in itself .. So, I got mislead into the notion that i can assign the "name " pointer into one of the array elements and then do what ever needed..
yeah, ok I shud have done that long time back
Code:
void input ( char *names[]){
int i;
char name[21];
for(i=0; i<3; i++)
{
printf("enter the name \n");
fgets(name,20,stdin);
names[i] = malloc (sizeof (char) * strlen(name) + 1);
names[i] = name ;
fputs(names[i],stdout);
printf("i=%d\n",i);
}
return ;
}
that is my function ..
In main I just print them out :
Code:
for(count=0;count < 3; count++)
fputs(names[count],stdout);
I just hope ,i havent made any real blunder with my sleepy eyes here..