I was browsing through some output questions in C language, where I found the following one.
Code:
#include<stdio.h>
int main()
{
char arr[] = "geeksforgeeks";
char *ptr = arr;
while(*ptr != '\0')
++*ptr++;
printf("%s %s", arr, ptr);
getchar();
return 0;
}
I ran the above code, and the output came out to be 'hffltgpshfflt'. Now the expression ++*ptr++ is quite confusing and it's difficult to understand what's exactly happening there. Any help regarding that would be appreciable. (Note- I do remember precedence rules/associativity but how that expression will get evaluated is my problem).