有没有办法在 C 中创建一个只有两个表达式的 for 循环? [英] Is there a way to create a for loop with only two expressions in C?
本文介绍了有没有办法在 C 中创建一个只有两个表达式的 for 循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 C 标准文本中遇到了这个问题,我可以找到 C99 或 C11 的任何版本,在 §6.8.5 :
I came across this in the C standard text, any version I can find for C99 or C11, at §6.8.5 :
iteration-statement:
while ( expression ) statement
do statement while ( expression ) ;
for ( expression ; expression ; expression ) statement
for ( declaration expression ; expression ) statement
这里的第四项似乎是一个只有一个分号的 for
,我在其他任何地方都没有看到对这种语法的任何引用.这里有人可以解释我错过了什么吗?
The fourth item here seems to be a for
with only one semicolon, and I don't see any reference to this syntax anywhere else. Can anyone here explain what am I missing?
推荐答案
declaration
的产生式是:
声明:
声明说明符init-declarator-listopt ;
所以分号已经是它的一部分了.
So the semicolon is already part of it.
这篇关于有没有办法在 C 中创建一个只有两个表达式的 for 循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文