8.c: In function ‘main’:
8.c:15: error: ‘L’ undeclared (first use in this function)
8.c:15: error: (Each undeclared identifier is reported only once
8.c:15: error: for each function it appears in.)
8.c:7: error: label ‘L’ used but not defined
这就是运行时出现的错误
下面是源代码
include
main()
{
int x,s=0;
printf("please input first integer:");
scanf("%d",&x);
if(x>10) goto L;
do
{
s+=x;
printf("input next data:");
scanf("%d",&x);
}while(x<=10);
L;
printf("s=%d\n",s);
}
mushan520 于 2009-04-27 23:13:08发表:
}while(x<=10);
L;
printf("s=%d\n",s);
定义一个标号时,应该是冒号,不是分号
L; 改成 L :
mushan520 于 2009-04-27 23:11:11发表:
兄弟还用goto!!!
牛人!
dumouren 于 2009-04-27 21:30:34发表:
多谢 兄台
哈
wang7131984 于 2009-04-27 20:53:59发表:
label ‘L’ used but not defined
你的LABEL定义错了,C语言中最好不要使用这种已经淘汰的语法。
dumouren 于 2009-04-27 20:38:29发表:
请各位高手出出招
帮帮小弟