请问这段c语言代码有什么错误啊,谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/17 06:53:59
#define LIST_INIT_SIZE 10;
typedef int Status;
#include <stdio.h>

typedef struct {
int* base;
int length;
int listsize;
} sqllist;

Status init(sqllist &L) { // 算法2.3
// 构造一个空的线性表L。
L.base = (int *)malloc(LIST_INIT_SIZE*sizeof(int));
if (!L.base) return 0; // 存储分配失败
L.length = 0; // 空表长度为0
L.listsize = LIST_INIT_SIZE; // 初始存储容量
return 1;
} // InitList_Sq

void main() {
printf("hello");

}

编译有如下错误
C:\Program Files\Microsoft Visual Studio\MyProjects\DS\hello.c(11) : error C2143: syntax error : missing ')' before '&'
C:\Program Files\Microsoft Visual Studio\MyProjects\DS\hello.c(11) : error C2143: syntax error : missing '{' before '&'
C:\Program Files\Microsoft Visual Studio\MyProjects\DS\hello.c(11) : e

#include <stdio.h>
#include <stdlib.h> //malloc声明所在的头文件

#define LIST_INIT_SIZE 10 //不应该有分号

typedef int Status;
typedef struct {
int* base;
int length;
int listsize;
} sqllist;

Status init(sqllist* L) { //C语言中没有引用这个概念,你是想传地址吧,那就是指针类型
// 构造一个空的线性表L。
L->base = (int *)malloc(LIST_INIT_SIZE*sizeof(int));
if (!L->base) return 0; // 存储分配失败
L->length = 0; // 空表长度为0
L->listsize = LIST_INIT_SIZE; // 初始存储容量
return 1;
} // InitList_Sq

void main() {
printf("hello");
}