#include <stdio.h>
struct node{
char ch;
struct node *next;
};
/* 1.初始化单链表*/
void init(struct Node **h)
{
*h = (struct node *)mallov(sizeof(struct node));
if(*h == NULL)
{
printf("空间申请失败...\n");
system("pause");
}
(*h)->next = NULL:
return;
}
/* 2.将x节点插入到链表后*/
void append(struct node *p, int x)
{
struct node *s;
s = (struct node *)malloc(sizeof(struct node));
if(*h == NULL)
{
printf("空间申请失败...\n");
system("pause");
}
s->ch = x;
while(p->next != NULL)
{
p = p->next;
}
p->next = s;
return;
}
/* 3.打印串*/
void display(struct node *p)
{
while(p->next != NULL)
{
printf("%c",p->next->ch);
p=p->next;
}
printf(" ");
return;
}