In the following code:
int strlen(char *s){
char *p = s;
while(*p++ != '\0');
return p - s;
}
Why does the above evaluate differently than this:
int strlen(char *s){
char *p = s;
while(*p != '\0') p++;
return p - s;
}
It is my understanding that the expression will evaluate first, and then increment.
i++and++i?int i = 3, j = 3; printf("%d, %d\n", ++i, j++);.