#include<malloc.h> #include<stdio.h> typedef struct sys{ int size; int musem; struct sys *next; }node; node *create(){ node *head,*p,*r; int x,y; head=r=(node *)malloc(sizeof(node)); printf("please input the num!"); scanf("%d",&x); r.musem=x; r.size=1; while(y!=0){ p=(node *)malloc(sizeof(node)); scnaf("%d",&y); p.musem=y; p.size=r.size+1; r.next=p; r=p; } r.next=NULL; return *head; } main(){ node *head,*p; char a; int c,i; head=create(); printf("println all the num[y/n]?\n"); p=head; scanf("%c",&a); if(a=="y") { while(p){ println("size is%d\n;musem is%d\n",p.size,p.musem); p=p.next; } } else { printf("please input the num!\n"); scanf("%d",&c); for(i=0;i<c;i++){ if(i==c){ p=p.next; } else printf("size is %d\n,musem is %d\n",p.size,p.musem); } } }
这是编译的报错,我为了方便就在windows上安装了个gcc编译器,每次写的线性表都会出错,这是线性表的链表
拜托哪位高手帮我解答一下
onemoo
相关分类