|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
}
typedef struct node SLIST;
SLIST *creat_slist1()
{ int c;
SLIST *h,*s,*r;
h=(SLIST *)malloc(sizeof(SLIST));
r=h;
scanf("%d",&c);
while(c!=-1)
{
s=(SLIST *)malloc(sizeof(SLIST));
s->data=c;
r->next=s;
r=s;
scanf("d",&c);
}
r->next='\0';
return h;
}
main()
{
SLIST *head;
head=creat_slist1();
return 0;
}
搞不懂为什么会出现这个错误
error C2236: unexpected 'struct' 'node'
struct node
{
int data;
struct node *next;
}
结构体声明最后要用分号结尾
|
|