Which one (Array or pointer) is located in read only portions of memory ?
In other words
char* x = "hello";
x[1] ='m';
I get error here
but when I use array like
char x[] ="hello";
x[1] ='m';
I don't get error
Also when I use malloc I get error too
char* x =malloc(sizeof(char)*10);
-----------------------
So what is the difference if I use malloc and don't use like char x[] ="hello"; and why I get error when I use either one and I don't get error when I use array?