C 的复职位置问题...中程考试引起的
main()
{
int i;
double a,b;
a=10.333432;
b=2.34211;
/* 问题就在这里, 如果我把 int i 移到这个位置, 请注意是移动, 而不是重复定义. 那么程序立刻出错, 难道是BUG */
i = (int)a/b;
printf ("%f\n",a / b);
printf ("%d\n",i);
}
C does not allow variable definition/declaration after the first execution statement. That is all the variable definition/declaration of a function must be put at the beginning.
C++ does not have this restriction.