Possible Duplicate:
Why do I get a segmentation fault when writing to a string?
I expect the output of this program to be: ibjgsjfoet But i am getting a segmentation fault.
#include <stdio.h>
int main()
{
char *p="haifriends",*p1;
p1=p;
while(*p!='\0')
++*p++;
printf("%s %s",p,p1);
return 0;
}