#include "LNode.h"
void main()
{
LNode L;
char ch[]={"abcdefg"};
int i;
ElemType e,pre_e,next_e;
int (*pfun)(ElemType,ElemType); /*定义函数指针*/
int equation(ElemType,ElemType);
InitList_Node(L); /*构造空的线性表*/
for(i=0;i<(int)strlen(ch);i++) /*为线性表赋值*/
ListInsert_Node(L,i+1,ch[i]);
ListDelete_Node(L,8,e); /*删除第i个节点*/
printf("%c having deleted!\n",e);
print_Node(L); /*输出线性表的每个数据元素*/
e='g';
pfun=equation;
printf("%c in No.%d\n",e,LocateElem_Node(L,e,pfun));/*输出元素e的位置*/
printf("%d\n",PriorElem_Node(L,e,pre_e)); /*查找e的前驱,输出前驱位置*/
printf("The PriorElem of %c is %c\n",e,pre_e); /*输出e的前驱节点的数据元素*/
printf("%d\n",NextElem_Node(L,e,next_e)); /*查找e的后继,输出后继位置*/
printf("The NextElem of %c is %c\n",e,next_e); /*输出e的后继节点的数据元素*/
}