In which data segment is the C string stored?
问题 I'm wondering what's the difference between char s[] = "hello" and char *s = "hello" . After reading this and this, I'm still not very clear on this question. As I know, there are five data segments in memory, Text, BSS, Data, Stack and Heap. From my understanding, in case of char s[] = "hello" : "hello" is in Text. s is in Data if it is a global variable or in Stack if it is a local variable. We also have a copy of "hello" where the s is stored, so we can modify the value of this string via