[C] 纯文本查看 复制代码/*
Name:Linklist operation.cpp
Author:X
Date:2020/3/13
Description: 线性表的基本操作及应用
*/
#include
#include //分配数据
#define ERROR 0;
#define OK 1;
typedef int ElemType;
typedef int status;
typedef struct LNode
{
ElemType data;
struct LNode *next;
}LNode,*LinkList;
//建立线性表LA ,头插法
status CreatList_LA(LinkList &LA,int n)
{
LNode *p;int i;
LA=(LinkList)malloc(sizeof(LNode));
LA->next=NULL;
for(i=n;i>0;--i)
{
p=(LinkList)malloc(sizeof(LNode));
scanf("%d",&p->data);
p->next=LA->next;
LA->next=p;
}
return OK;
}
//建立线性表LB
status CreakList_LB(LinkList &LB,int n)