字符串和字符数组存储在哪里?
int main ()
{
int a = 0; //This should be stack
char* p = "hello"; // why this is on the static?
char k[10] = "hello"; //on the stack?
}
Run Code Online (Sandbox Code Playgroud)
一本教科书上说char指针(Char* a)会存储在静态内存中,从我对“静态内存”的理解来看,只有这2个会存储在静态内存中:
int a=0;// will on the static
int main()
{
static xxxxx; //will on the static.
}
Run Code Online (Sandbox Code Playgroud)