#include <stdio.h> int main (void) { char *str = "Hello"; //defining and initializing the str pointer, which is directing to 'H'. printf("%s\n", str); printf("%p\n", str); return 0; } The Result is:
Hello 0000000000404000 My question is where did 0000000000404000 come from?
printf(%p\n", (void*)str);instead,%pexpects avoidpointer.printfs. What did you expect the secondprintfto do?"Hello"is stored in memory. It must be stored somewhere – so why not there?