Code:I am tryin to store strings in an array **ro in vain.... any idea why it gives a compile time error..
char **ro;
while(fgets(c,sizeof(c),fq)!=NULL)
{
*ro=c;
ro++;
}
Printable View
Code:I am tryin to store strings in an array **ro in vain.... any idea why it gives a compile time error..
char **ro;
while(fgets(c,sizeof(c),fq)!=NULL)
{
*ro=c;
ro++;
}
This is a very closely related problem to your previous question. Did you read my reply, and if so, did you understand it?
[Actually, I don't really see why you should get a compile-time error, but I can see how it would definitely crash instantly when you get there at runtime].
--
Mats
Code:yes... i did look at the first one and i had a problem applying strcpy thatz why i tried alil different one... it compiled but when i try to print in a separate loop, it prints only the last string.... meaning it replacing a string for a string... need some help in that...
while(fgets(c,sizeof(c),fq)!=NULL)
{
aqq[count]=c;
count++;
}
char **ar=aqq;
while(*ar){
printf("new %s",*ar);
ar++;
}
Quote:
i also don't understand malloc
Code:note
Ok, so malloc() is a function that "gives you a piece of memory that is of a certain size" [or if it can't, you get a NULL pointer back].
You probably need to read up on pointers a little bit. There is a tutorial at the main page , www.cprogramming.com, that explains more about pointers and dynamic memory.
--
Mats
STOP putting ALL your post inside code tags. It creates needlessly wide posts since all your words are strung out into one long line.