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++; }
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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++; }
i also don't understand mallocCode: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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
STOP putting ALL your post inside code tags. It creates needlessly wide posts since all your words are strung out into one long line.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.