A few questions about char pointers.
- by m4design
1- How does this work:
char *ptr = "hi";
Now the compiler will put this string in the memory (I'm guessing the stack), and create a pointer to it? Is this is how it works?
2- Also if it is created locally in a function, when the function returns will the memory occupied by the string be freed?
3- Last but not least, why is this not allowed:…