小编Sad*_*lad的帖子

c中char数组和字符串的内存位置

字符串和字符数组存储在哪里?

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)

c c-strings

2
推荐指数
1
解决办法
176
查看次数

标签 统计

c ×1

c-strings ×1