#include <stdio.h>#include <stdlib.h>//顺序存储类型定义typedef int DataType;#define MaxSize 1024typedef struct{ DataType data[MaxSize]; int Last; struct SeqList *L;}SeqList;//插入函数int SeqInsert(SeqList *L, DataType x, int i){ //将新结点插入到第i个位置 int j; if((*L).Last == MaxSize - 1){ printf("Overflow"); return 0; }else{ if((i < 1) || (i < (*L).Last +1)){ //插入位置非法 printf("Position Error"); return 0; }else{ for(j = (*L).Last; j >= i-1; j--) (*L).data[j+1] = (*L).data[j]; //结点后移 (*L).data[i-1] = x; //插入x (*L).Last++; //表长加1 } return 1; }}//删除运算int SeqDelete(SeqList *L, int i){ //删除第i个结点 int j; if(i < 1 || i> (*L).Last + 1){ //插入位置非法 printf("Position Error"); return 0; }else{ for( j = i; j<=(*L).Last + 1; j++) (*L).data[j-1] = (*L).data[j]; //结点前移 (*L).Last--; //表长减1 } return 0;}