I know that many people asked this but I still have some questions about it. I read that writing:
char *string = "mystring";
Makes it a read only array of characters, if I were trying to do:
string[0] = 'l';
I would get an error. When I write:
char string[] = "mystring";
it is saved on the stack, just on the current scope. what about the char*? is it saved on the heap? or on the stack?
And when I tried writing:
char *string = "mystring";
And then:
string = "mystring2";
it worked, but what happened to the old "mystring" array? is there a memory leak caused by doing this?