C++ string literal data type storage

前端 未结 8 1057
一生所求
一生所求 2020-11-30 10:03
void f()
{
    char *c = \"Hello World!\"
}

Where is the string stored? What\'s the property of it? I just know it is a constant, what else? Can I

8条回答
  •  渐次进展
    2020-11-30 10:19

    It's implementation defined. Most of the time that would be stored in a string table with all the other strings in your program. Generally you can treat it like a global static const variable except it's not accessible outside your function.

提交回复
热议问题