"012"; // is allocating 3 chars on stack and initializing them with those values all at runtime.
char *f = "012"; // this one is storing the string "012" on data section at compile time and put its address on that pointer at runtime. you can find that string in binary for example see its data section with objdump.
I think both are in data section, the only part in the stack is the pointer
Обсуждают сегодня