#include<stdlib.h>
#include<stdio.h>
#define ERROR 0
#define OK 1
typedef int ElemType; //建立带表头结点的单链表
typedef struct node
{
ElemType element;
struct node *link;
}node;
typedef struct
{
struct node *head;
int n;
}headerList;
typedef int Status;
Status Init (headerList *h ) //对单链表初始化
{
h->head=(node*)malloc (sizeof(node));
if(!h->head)
return ERROR;
h->head->link=NULL;
h->n=0;
return OK;
}
Status Insert(headerList *h,int i,ElemType x)//单链表的插入操作
{
node *p,*q;
<
#include<stdio.h>
#define ERROR 0
#define OK 1
typedef int ElemType; //建立带表头结点的单链表
typedef struct node
{
ElemType element;
struct node *link;
}node;
typedef struct
{
struct node *head;
int n;
}headerList;
typedef int Status;
Status Init (headerList *h ) //对单链表初始化
{
h->head=(node*)malloc (sizeof(node));
if(!h->head)
return ERROR;
h->head->link=NULL;
h->n=0;
return OK;
}
Status Insert(headerList *h,int i,ElemType x)//单链表的插入操作
{
node *p,*q;
<