对线性表运算的小实验出现问题,求指教
源码如下#include<stdio.h>
#include<stdlib.h>
#define maxsize 100
typedef struct
{
int length;
int elem[maxsize];
}pselist;//定义线性表的内容
pselist listinit()
{
pselist L;
L.length=0;
return L;
}//线性表初始化
void listinsert(pselist L,int i,int x)
{
int j;
if(L.length==maxsize)
{printf("full");exit(0);}
if(i<1||i>L.length+1)
{printf("the position is wrong");exit(0);}
for(j=L.length-1;j>=i-1;j--)
L.elem[j+1]=L.elem[j];
L.elem[i-1]=x;
L.length++;
}//线性表的元素插入
int main()
{
pselist L1;
int x;
scanf("%d",&x);
L1=listinit();
listinsert(L1,1,x);
printf("%d",L1.elem[0]);
return 0;
}