如何确定一个整数是否未分配?
int i; /* no assignment */
if (/* conditional statement here to check if int i is unassigned or not */) {
printf("Integer is unassigned!\n");
} else {
printf("Integer is assigned!\n");
}
最佳答案
你不能。它将包含“未定义”内容,这意味着它将包含当时该内存位置中发生的所有内容。
. . .除非在全局范围内声明 i,否则它将被初始化为零。
关于C - 检查是否分配了 Integer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1226489/