这个顺序表插入的地方哪里错了?
#include<stdio.h>#include<stdlib.h>
#include<malloc.h>
#define M 50
typedef char ElemType;
typedef struct node
{
ElemType data[M];
int length;
}sqlist;
void creat(sqlist *l)
{
l=(sqlist *)malloc(sizeof(sqlist));
l->length=0;
}
void Insert(sqlist *l,int i,ElemType e)
{
int j;
if( i<0 || i>l->length-1 )
{
exit(0);
}
for(j=l->length-1;j>i;j++)
{
l->data[j-1]=l->data[j];
}
l->data[i]=e;
l->length++;
}
int main()
{
sqlist l;
creat(&l);
char m;
int i=0;
int j=0;
while( scanf("%c",&m) && m!='\n' )
{
Insert(&l,i,m);
i++;
}
while(j<l.length-1)
{
printf("%c",l.data[j]);
j++;
}
return 0;
}