void main()
{
int a=5,*p,*c=NULL;
printf("p=%u",p); //OUTPUT p=3839036080
printf("\nc=%u",c); //OUTPUT c=0
}
这里我们没有为p
分配任何地址,那么为什么它还要打印任何东西呢?并且 c
被分配了 NULL
所以这意味着它将值存储为 0
?
最佳答案
Here we haven't assigned any address to p then why is it even printing anything?
您调用了printf()
,因此它必须打印某些内容。该变量未初始化,因此它会打印用于保存该变量的内存中发生的任何内容。
And c is assigned NULL so this means it stores the value as 0?
是的,NULL
是一个扩展为 0
、(char *)0
或等效内容的宏。
关于c - 请解释该程序中的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47043105/