链表
链表的基本操作函数
1.定义一个链表
typedef struct node
{
int data;
struct node *next;
}LNode;
2.尾插法建立链表
void create_tali(LNode *h)
{
int x;
LNode *p,*r;
r=h;
while(~scanf("%d",&x)&&x)
{
p=(LNode *)malloc(sizeof(LNode));
p->data=x;
r->next=p;//这两步骤记住是关键,重要
r=p;//这两步骤记住是关键,重要
}
r->next=NULL;//尾插法写左后是空,头插法就不用了
}
3.头插法建立链表
void create_head(