請參見下面的代碼:混淆初始化炭[]
char h[256];
h[0]=NULL;
if(h!=NULL)
{
printf("It doesn't show NULL\n");
}
else
{
printf("It shows NULL\n");
}
,並且還執行以下操作:
char h[256];
if(h!=NULL)
{
printf("It doesn't show NULL\n");
}
else
{
printf("It shows NULL\n");
}
,並且還執行以下操作:
char h[256];
h[0]='\0';
if(h!=NULL)
{
printf("It doesn't show NULL\n");
}
else
{
printf("It shows NULL\n");
}
在每種情況下的char* h
不具有NULL。爲什麼會這樣?是不是因爲我沒有在那裏存儲任何東西而有空值?如果情況並非如此,我該如何確保它只包含NULL?