创建链表怎么不可以输出啊!
#include<stdio.h>#define NEW (SLIST *)malloc(sizeof(SLIST))
#include<stdlib.h>
typedef struct node
{
int data;
struct node *next;
}SLIST;
SLIST *creat_slist()
{
int c;
SLIST *h,*r,*s;
h=NEW;
r=h;
scanf("%d",&c);
while(c!=-1)
{
s=NEW;
s->data=c;
r->next=s;
r=s;
scanf("%d",&c);
}
r->next='\0';
return h;
}
void print_slist(SLIST *h)
{
SLIST *p;
p=h->next;
if(p='\0') printf("link_slist is null!\n");
else
{ printf("head\n");
do
{printf("->%d",p->data);
p=p->next;
}while(p!='\0');
printf("end\n");
}
}
main()
{
SLIST *head;
head=creat_slist();
print_slist(head);
}