Today when learning pointer in C, I have faced a problem. I wrote this code:
#include<stdio.h>
int main()
{
char *p="XAD";
printf("%c\n",(*p));
printf("%c\n",++(*p));
return 0;
}
First printf() shows correct output and it is X. But for second output, compiler crashes. But why? If (*p) gives 'X'(as expected), then ++(*p) should give 'Y'. Shouldn't it?