<分区>
#include<stdio.h>
int main()
{
for(;NULL;)
printf("STACK");
return 0;
}
输出:堆栈 我知道 NULL 的 ascii 值为 0,它是假的,但是当我在 turbo c 上运行时,这个程序给出输出“STACK”,这是怎么可能的。
<分区>
#include<stdio.h>
int main()
{
for(;NULL;)
printf("STACK");
return 0;
}
输出:堆栈 我知道 NULL 的 ascii 值为 0,它是假的,但是当我在 turbo c 上运行时,这个程序给出输出“STACK”,这是怎么可能的。
最佳答案
“STACK”从不输出。这是因为 for
语句的条件部分始终为假(假设 NULL
是 #define
d as (void *)0
。
关于c - 具有 NULL 条件的 for 循环,为什么 printf();执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10965221/