线性表的顺序储存源代码的改错
编译出4个错,怎么改,本人新手,这是关于线性表的顺序储存#include<stdio.h>
#include <stdlib.h>
#define Listinitsize 100
#define Listincrement 10
typedef struct {
int *elem;
int length;
int listsize;
}Sqlist;
int InsertSList(Sqlist *L,int n,int i,int x);
int DeleteSList(Sqlist *L,int n,int i);
main()
{
int i,n,m,x;
Sqlist L;
printf("请输入线性表的表长:");
scanf("%d",&n);
printf("\n");
printf("the list element is:");
for(i=0;i<n;i++)
scanf("%d",&i);
printf("请选择\n1:插入元素操作\n2:删除元素操作");
scanf("%d",&m);
switch(m)
{
case 1:{
printf("i=,x=:");
scanf("%d,%d",&i,&x);
InsertSList(Sqlist *L,int i,int n,int x);
}
break;
case 2:{
printf("i=:");
scanf("%d",&i);
int DeleteSList(Sqlist *L,int i,int n);
}
break;
default:
printf("ERROR");
}
int DeleteSList(Sqlist *L,int i,int n)//在长度为n的L线性表删除第i个元素
{
int j,y;
if(i<1||i>n+1)
{
printf("ERROR");
return 0;
}
else
{
y=L[i];
for(j=i+1;j<n;j++)
{
L[j]=L[j+1];
}
n=n-1;
return 1;
}
int InsertSList(Sqlist *L,int i,int n,int x)//在长度为n的L线性表的第i个元素之前插入
{
int j;
if(i<1||i>n+1)
{
printf("ERROR");
return 0;
}
else
{
for(j=n;j<n;j--)
{
L[j+1]=L[j];
}
L[i]=x;
n=n+1;
return 1;
}