标题:C 的循环语句
取消只看楼主
白色的天
Rank: 2
等 级:论坛游民
帖 子:24
专家分:17
注 册:2013-11-9
结帖率:80%
已结贴  问题点数:10 回复次数:2 
C 的循环语句
程序代码:
#include <stdio.h>
int main(void)
{
printf("\n***************");
for(int count=1;count<=8;++count)
{
printf("\n*  *");
printf("\n***************\n");
}

return 0;
}

D:\VS测试文件\day161\c.c(5) : error C2143: syntax error : missing ';' before 'type'
D:\VS测试文件\day161\c.c(5) : error C2143: syntax error : missing ';' before 'type'
D:\VS测试文件\day161\c.c(5) : error C2143: syntax error : missing ')' before 'type'
D:\VS测试文件\day161\c.c(5) : error C2143: syntax error : missing ';' before 'type'
D:\VS测试文件\day161\c.c(5) : error C2065: 'count' : undeclared identifier
D:\VS测试文件\day161\c.c(5) : warning C4552: '<=' : operator has no effect; expected operator with side-effect
D:\VS测试文件\day161\c.c(5) : error C2059: syntax error : ')'
D:\VS测试文件\day161\c.c(6) : error C2146: syntax error : missing ';' before identifier 'printf'
根据这错误提示说类型有错误,不懂那里有错,本人刚学C,请大家指点......
搜索更多相关主题的帖子: color count 
2014-10-16 12:20
白色的天
Rank: 2
等 级:论坛游民
帖 子:24
专家分:17
注 册:2013-11-9
得分:0 
回复 2 楼 vvvcuu

2014-10-16 13:00
白色的天
Rank: 2
等 级:论坛游民
帖 子:24
专家分:17
注 册:2013-11-9
得分:0 
回复 4 楼 魑魅魍魉!
谢谢,解决了,但是为什么不能在for括号里声明并且初始化,我看了其他代码也是在for括号里面的第一个表达式里声明并且初始化
2014-10-16 13:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-437316-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.409227 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved