Here in the below program, the 'c' pointer has not been modified. Still, it's printing the second element of the array instead of the first one i.e. 'a'. Can anyone explain this behavior? The first two characters are printed correctly but the third one is something unusual.
#include <stdio.h>
int main()
{
char arr[] = {'a','m','r'};
char *a = arr;
char *b = arr;
char *c = arr;
*++a;
++*b;
printf("%c %c %c",*a,*b,*c);
return 0;
}
Output:
m b b