I read this on wikipedia
int main(void)
{
char *s = \"hello world\";
*s = \'H\';
}
When the program containing this code is com
There is a big difference between:
char * s = "Hello world";
and
char s[] = "Hello world";
In the first case, s
is a pointer to something that you can't change. It's stored in read-only memory (typically, in the code section of your application).
In the latter case, you allocate an array in read-write memory (typically plain RAM), that you can modify.