编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#103600 #105. zxh的继承顺位 Compile Error 0 0 ms 0 K C / 400 B 安然 2024-03-21 23:18:24
显示原始代码
#include <stdio.h>
#define MaxSize 10000
typedef struct {
    int data[10000];
    int length;
} SqList;

void InitList(SqList &L) {
    for (int i = 0; i < MaxSize; i++) L.data[i] = 0;
    L.length = 0;
}

int mian() {
    SqList L;
    for (int k = 1; k < 10000; k++) {
        if (k % 2 != 0 && k % 3 != 0 && k % 5 != 0) {
            InitList(k);
        }
    }
    scanf("%d", &n);
    printf("%d", data[n]);
}

编译信息

/sandbox/1/a.c:8:22: error: expected ')'
void InitList(SqList &L){
                     ^
/sandbox/1/a.c:8:14: note: to match this '('
void InitList(SqList &L){
             ^
/sandbox/1/a.c:8:22: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
void InitList(SqList &L){
                     ^
/sandbox/1/a.c:10:5: error: use of undeclared identifier 'L'
    L.data[i]=0;
    ^
/sandbox/1/a.c:11:5: error: use of undeclared identifier 'L'
    L.length=0;
    ^
/sandbox/1/a.c:18:22: error: passing 'int' to parameter of incompatible type 'SqList'
            InitList(k);
                     ^
/sandbox/1/a.c:8:22: note: passing argument to parameter here
void InitList(SqList &L){
                     ^
/sandbox/1/a.c:21:17: error: use of undeclared identifier 'n'
    scanf("%d",&n);
                ^
/sandbox/1/a.c:22:17: error: use of undeclared identifier 'data'
    printf("%d",data[n]);
                ^
/sandbox/1/a.c:22:22: error: use of undeclared identifier 'n'
    printf("%d",data[n]);
                     ^
1 warning and 7 errors generated.