【发布时间】:2017-04-26 22:15:03
【问题描述】:
for 循环的第一条语句发生了什么?我似乎无法理解为什么 1 == 2 可以接受,因为它是比较而不是赋值。
char ch = 120;
unsigned char x = 1;
unsigned int y = 1;
for(1 == 2; ch > 0; ch++) {
printf("%d\n", ch);
x <<= 1;
y *= 2;
}
【问题讨论】:
-
欢迎来到 Stack Overflow。请注意,在这里说“谢谢”的首选方式是投票赞成好的问题和有用的答案(一旦你有足够的声誉这样做),并接受对你提出的任何问题最有帮助的答案(这也给出了你的声誉小幅提升)。请查看About 页面以及How do I ask questions here? 和What do I do when someone answers my question?
标签: c for-loop comparison-operators