-
Use of while
Is this a valid use of the while() command?
char *p1;
char name[100];
.
.
.
while((p1=strchr(name,','))!=NULL) memmove(p1,p1+1,strlen(p1));
My compiler compiles fine, but when I execute it, the brackettes of other statements get all screwed up and the program flow/logic is fragged. Doing the following works as expected:
while((p1=strchr(name,','))!=NULL) {
memmove(p1,p1+1,strlen(p1));
}
-
Both loops are valid and correct. Could you show some more of your code? Perferably something we can compile and play with?
-Prelude