vs2022编译c++顺序表时出现错误!!

img

#include<stdlib.h>
#include<stdio.h>
#define MaxSize 20
int main() {
typedef char ElemType;
typedef struct {
ElemType date[MaxSize];
int length;
}SqList;
void CreatList_Sq(ElemType a[]);
{
int n;
SqListL;
int i;
L = (SqList
)malloc(sizeof(SqList));
for ((i = 0); i < n; i++)
L->date[i] = a[i];
L->length = n;
}
void InitList_Sq();
{
SqList* L;
L = (SqList*)malloc(sizeof(SqList));
L->length = 0;
}
bool ListInsert_Sq(); {
ElemType e;
int j;
int i;
SqListL;
if (i<1 || i>L->length + 1)
return false;
i--;
for (j = L->length; j > i; j--)
L->date[i - 1] = e;
L->length++;
return true;
}
void ListTraverse_Sq();
{
SqList
L;
int i;
for (i = 0; i < L->length; i++);
printf("%d", L->date[i]);
printf("\n");
}
}

首先,main函数里不要写那么多函数代码,这些函数全部放到main函数之前。
其次,函数定义后面的分号不能写
然后,InitList_Sq()函数中,你这个L在函数内定义有啥用啊,这个初始化毫无意义,外部代码根本不可能访问这个L
最后,一半的学生写代码的时候data和date两个单词都搞不懂啥意思......

函数名后面的分号去掉