我说的前两点,是在C老标准中,for中不能定义变量
[/Quote]
C99好像可以在for中定义变量的吧
6.8.5.3 If clause-1 is a declaration, the scope of anyidentifiers it declares is the remainder of the declaration and the entire loop, including the other two expressions;
说错了,应该是x03
If the for-init-statement is a declaration, the scope of the name(s)
statement. [Example:
int i = 42;
int a[10];
for (int i = 0; i < 10; i++)
a[i] = i;
int j = i; // j = 42