Some additions:
1. To print pointer value use %p (not %d) format specifier. As usually, it's a senseless operation

.
2. True type of a string literal is
const char* - a constant pointer to the 1st element of a char array contained a string with terminated null character. You can't change string literal via pointer to it. Constructs like
are valid (for backward compatibility with older C programs) but modern compilers place literals in read-only memory.
3. An array name is not converted to a pointer to the 1st element of an array
(&array[0]) in
sizeof array_name (operator sizeof argument position).
Last edited by ArkM; Dec 1st, 2008 at 6:04 am.