首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

下列程序编译哪里出错解决办法

2012-02-20 
下列程序编译哪里出错#includestdio.hinlist *creatlist(inlist *l){}//error C2143: syntax error : m

下列程序编译哪里出错
#include<stdio.h>
inlist *creatlist(inlist *l){}; //error C2143: syntax error : missing '{' before '*'
int len_list(inlist *l){};
int loc_list(inlist *l,int x){};
struct inlist
{
int data;
inlist *next;
};
main()
{
inlist *l=malloc(sizeof(inlist));
int x=0,k=0,len=0;
l=creatlist(l);
len=len_list(l);
scanf("%d",&x);
k=loc_list(l,x);
if(k==-1)
{
printf("None!\n");

}
else
{
printf("result=%d\n",k);
}
}

[解决办法]
按C++编译可以,但按C编译要改为:

typedef struct _inlist
{
int data;
struct _inlist *next;
}inlist;

热点排行