#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#define LIST_INIT_SIZE 100
#define Elemtype int
#define ERROR -1
#define Status int
typedef struct{
Elemtype* elem;
int length;
int listsize;
}Sqlist;
//make a new list
Status initlist(Sqlist &L)
{
L.elem = (Elemtype*)malloc(LIST_INIT_SIZE * sizeof(Elemtype));
if (!L.elem) {
printf("error");
exit(ERROR);
}
L.length = 0;
L.listsize = LIST_INIT_SIZE;
return 0;
}
int main()
{
Sqlist L;
Status initlist_Sq(L); //此处括号内L报错
for (int i = 0; i < 10; i++)
{
scanf_s("%d", &L.elem[i]);
L.length++;
}
printf("\nconcequence:");
for (int j = 0; j < L.length; j++)
{
printf("%d,", L.elem[j]);
}
return 0;
}
你调用的是initlist_Sq函数,可你上面定义的函数是initlist,函数名都不对啊