注册 登录
编程论坛 C++教室

为什么会出现syntax error : missing ';' before 'type'

爱海涛涛 发布于 2012-03-24 21:42, 6647 次点击
#include<stdio.h>
int tex(int x )
{
    int f=0,i;
    for(i=2;i<=(x-1);i++)
     if(x%i==0)
         f=1;
     return f;
}
main()
{int b,a;
    scanf("%d",&b);
    int tex(int );
     a=tex(b);
printf("%d",a);
}
4 回复
#2
徐宗保2012-03-24 22:04
我建立了没有错误,但是却运行不了
#3
cheenhao2012-03-24 23:12
我运行没问题,只有个警告说主函数没有返回值。
#4
爱海涛涛2012-03-24 23:40
这样声明没错啊
#5
骆彬彬2012-03-25 00:31
楼主工程可能建立有错误,建立重新建工程+CPP文件,编译一下,
源程序没有错误,为保无错,可定义主函数main为  void型或者 int 型
希望能帮助你!!!
1