主函数怎么调用函数(数据结构,创建链表)0
rnxm44602018.09.29浏览179次分享举报
#include#include"stdlib.h"typedefintElemType;typedefstructnode{ElemTypedata;structnode*next;}slink;slink*creslink(intn){slink*head,*p,*s;inti;p=head=(slink*)mall... #include
#include "stdlib.h"
typedef int ElemType;
typedef struct node
{
ElemType data;
struct node *next;
}slink;
slink*creslink(int n)
{slink*head,*p,*s;
int i;
p=head=(slink *)malloc(sizeof(slink));
for(i=1;i<=n;i++)
{s=(slink *)malloc(sizeof(slink));
scanf("%d",&s->data);
p->next=s;
p=s;
}
p->next=NULL;