About your first question, when you write char* p = "i am a pointer", what happens is that the string "i am a pointer" is allocated on the stack and the p pointer actually points to the memory address of the stack string
That is most certainly not true, i.e. the literal string is not allocated on the stack.
The compiler has to be at its smartest to be able to deduce that string literals
can be allocated on stacks, especially when the address of that string might
be propagated to outer scopes.
The only thing that is guaranteed is that the string literal is allocated in memory
that is most likely not writable. Of course pointer p points to that string.
Most compilers put literal strings in the 'rodata' (Read Only data) segment,
some simply stick it in the data segments (where the string will be writable).
It is not defined by any language standard though so it's safest to think of
literal strings to be read only data.
kind regards,
Jos