求教~~~~~~~~~~~~!
那位高手能解释一下p=(linklist *)malloc (sizeof (linklist))和p->next=null是什么意思,干什么用。全程序如下:
typedef int elemtype;
typedef struct node;
{ elemtype data;
struct node *next;
}linklist;
linklist *head,*p,*q;
linklist *creat_list()
{
char x;
linklist *head,*p,r;
p=(linklist *)malloc (sizefo(linklist));
head=p;
p->next=NULL;
r=p;
printf("建立单链表,输入#号则退出.\n);
scanf("%c",&x);
while(x!=`#`)
{p=(linklist *)malloc (sizefo(linklist));
p->data=x;
p->next=NUll;
r->next=p;
r=r->next;
scanf("%c",&x);
}
return(head);
}