代码如下:
bool ListInsert(sqList &L,int i,ElemType e){
if(i<1||i>L.length+1)
return false;
if(L.length>MaxSize)
return false;
for(int j=L.length;j>=i;j--)
L.data[j]=L.data[j-1]; //顺序表L的指针范围是[0,L.length)
L.data[i-1]=e;
L.length++;
return true;
}