初学c语言,卡住某个问题。
int i=0;
for (i=1;i<=10;i++)
{
printf("a ");
}
用的软件是DEV-C++5.1
输入上面那段后按编译运行
出现
[Error] expected identifier or '(' before 'for'
[Error] expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
[Error] expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
是什么问题?
你给出的语句都没有错,但c语言程序要有头文件,程序要放在main()函数中的。下面是可以运行的和程序:
#include <stdio.h>
int main()
{
int i=0;
for (i=1;i<=10;i++)
{
printf("a
");
}
return 0;
}
程序的运行结果如下:
用英文字符重新输入一遍
下一篇:哪里错了
热门标签: