CASE 1: char s[][6]={"Hello","world"};
in this case, a static array is allocated in read-only memory and from there the elements are copied to the array.
and in case 2.
CASE 2: char* s= "hello world";
will place it in read-only memory.
so my question is why
char s[][6]={"Hello","world"};
s[1]="lucky"; //is illegal
because if elements are being copied from read-only memory then why this statement s[1]="lucky";
can't be copied from read-only memory to array because an array is also allocated for this string literal and from there, elements are copied to s[1].
I have read many answers, and all are telling what's the difference but no one tells why? please explain as I am a beginner.