Quote:
Originally Posted by infierno
char *p; only allocates the sufficient memory to hold the address of the pointer but not the rest elements of the "array". What this really means?, you have a char type pointer with 4 bytes allocated but a string with more than 15 characters.
actually, this's not what happens.
a pointer is in most cases is in size of a CPU register, on 32-bits machines, it's usually 32-bits, ie 4-bytes. this 4 bytes contains not data, but a value that is a memory address where the data is held. compiler will not complain, and it's very valid. what happens is, p will get the beginning address of the constant data (usually stored in .rodata -stands for read only data- section, but may differ with the contents of linkscript) in a memory location that should behave as ROM.