#include<stdio.h>
main()
{
char c = 'R';
printf("%c\n",c);
c++;
printf("%c\n",c);
char *ptr ="Ramco Systems";
printf("%c\n",(*ptr));
(*ptr)++;
printf("%d\n",(*ptr));
}
The output of the first, second ,3rd printf are 'R', 'S' & 'R' (as expected). However the line "(*ptr)++;" gives runtime error. Can someone explain why ?
Rto next ansi character, so there is no typo in the code - just the memory addressed by the pointer is non-modifiable.