|
|
ABCDEFGHIJ CIJDBEAHGF CFBDEIGAHJ IDJABEFGHC DBJIFEGACH |
char s[]="ABCDEFGHIJ";
instead of char *s="ABCDEFGHIJ";
char *s="ABCDEFGHIJ";
declares a pointer to read-only memory that holds "ABCDEFGHIJ"
while char str[]="ABCDEFGHIJ"
puts the "ABCDEFGHIJ"
into read-only memory and copies the string to newly allocated memory on the stack.