【发布时间】:2012-11-14 04:44:43
【问题描述】:
void testFunc(int);
int main(int argc, char** argv) {
testFunc(1);
testFunc(2);
testFunc(3);
return (EXIT_SUCCESS);
}
void testFunc(int another)
{
int num;
printf("num: %i\n", num);
num = another;
}
输出: 号码:127383283 数量:1 数量:2
如果我在每次将变量分配给某个东西之前打印它,我不应该总是得到没有静态关键字的垃圾值吗?
【问题讨论】:
-
这是未定义的行为,不要浪费你的时间去推理损坏的代码。