I've been given a code:
And I'm asked what is the output. I found out that the output is 1 by compiling the code, but I don't really know why. Seems like advance() doesn't change the string, although it gets a pointer to it.Code:char *advance(char *ptr) { return ptr++; } int main() { char *ptr="12"; advance(ptr); ptr=advance(ptr); printf("%c",*ptr); return 0; }
I'll appreciate any help.