--- In [email protected], kathir resh <resh_perso...@...> wrote: > > main() > { > char *p="hai friends",*p1; > p1=p; > while(*p!='\0') > ++*p++; > printf("%s%s",p,p1); > } > output ibj!gsjfoet > please explain it...... > > what is the difference between ++*p and p++........whether here ++*p means it > increments its pointed value ....p++ means it increments its address... help > me.....
++*p++ is the same as ++(*(p++)). So address p is incremented, but the pre-increment value of p is returned. So the (character) value at the pre-increment address p is incremented. Alternatively: *p = *p + 1; /* increment character at address p */ p = p + 1; /* increment address p */ HTH
