C语言与C++中for循环的不同点 C语言不允许在for循环表达式1中定义变量(如定义int i是不允许的),但C++中是允许的,以下写法需要保存为.cpp文件才能编译通过。 for (int i, i<n, i++){ …… }