Folks, I have basic and simple question on pointers. The below is code is giving a segmentation fault.
int main()
{
char *str = "hello, world\n";
char *strc = "good morning\n";
strcpy(strc, str);
printf("%s\n", strc);
return 0;
}
Can't we copy from pointer to other.
- if i have char *strc = "good morning\n", can't i do like this strc[5] = '.';. Why this also giving a seg fault.