I think it's put in the stack because the string "Hello world" is a parameter of function printf?
If i'm wrong, can someone give and explane the correct answer?
I think it's put in the stack because the string "Hello world" is a parameter of function printf?
If i'm wrong, can someone give and explane the correct answer?
String literals have static storage duration. Commonly they are stored in read-only memory. They usually go into sections called .rodata (linux) or .rdata (windows). Providing the string literal as a function parameter behaves the same as defining it as const char *s = "Hello world"
beforehand.
Have a look at these discussions: