#include<stdio.h>
#define LIST_INIT_SIZE 100//线性存储空间的初始分配量
#define LISTINCREMENT 10//线性存储空间的分配增量
typedef struct{
ElemType * elem;//存储空间基址
int length;
int listsize;
}Sqlist;
Status CreatList_Sq(SqList &L)
{//构造一个线性表L
L.elem =(ElemType *)malloc(LIST_INIT_SIZE*SIZEOF(ElemType));
if(! L.elem) exit(OVERFLOW);//存储分配失败
L.length =0;
L.listsize=LIST_INITY_SIZE;//初始存储容量
int i ;
for(i=0;i<listsize;i++)
scanf("%d",L[i]);
return OK;
}//InitList_Sq
Status ListInsert_Sq(SqList&L,int i,ElemType e){
//在顺序表中第i个位置之前插入新的元素e ,
//i 的合法值为1=<i<=ListLength_Sq(L)+1
if(i<1||i>L.length+1) return error;//i值不合法
if(L.length>=L.listsize)
{//当前存储空间已满,增加分配
newbase = (ElemType *)realloc(L.elem,(L.listsize+LISTINCREMENT)*sizeof(ElemType));
if(!newbase)exit(OVERFLOW);//存储分配失败
L.elem=newbase;//新基址
L.listsize +=LISTINCREMENT;//增加存储容量
}
q=&(L.elem[i-1]); //q为插入位置
for(p=&(L.elem[L.length-1]);p>=q;--p)
*(p+1)=*p);//插入位置及以后的元素后移
*q=e;//插入e
++L.length;//表长增一
return OK;
}//ListInsert_Sq
void main()
{
printf("!/n")
L=Status CreatList_Sq(SqList &L);
count"L"
}