编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#25605 #1141. ddd和鸵鸟 Compile Error 0 0 ms 0 K C / 238 B 经济99-刘雨泽 2020-05-29 11:10:13
显示原始代码
#include <stdio.h>
int main() {
    int n;
    scanf_s("%d", &n);
    long int sum = 0;
    int q;
    while (n > 0) {
        scanf_s("%d", &q);
        sum += q;
        n--;
    }
    if (sum % 2 == 0)
        printf('ddd');
    else
        printf('bqp');
    return 0;
}

编译信息

/sandbox/1/a.c:5:2: warning: implicit declaration of function 'scanf_s' is invalid in C99 [-Wimplicit-function-declaration]
        scanf_s("%d", &n);
        ^
/sandbox/1/a.c:15:10: warning: multi-character character constant [-Wmultichar]
                printf('ddd');
                       ^
/sandbox/1/a.c:15:10: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                printf('ddd');
                       ^~~~~
/usr/include/stdio.h:318:43: note: passing argument to parameter '__format' here
extern int printf (const char *__restrict __format, ...);
                                          ^
/sandbox/1/a.c:15:10: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
                printf('ddd');
                       ^~~~~
/sandbox/1/a.c:15:10: note: treat the string as an argument to avoid this
                printf('ddd');
                       ^
                       "%s", 
/sandbox/1/a.c:17:10: warning: multi-character character constant [-Wmultichar]
                printf('bqp');
                       ^
/sandbox/1/a.c:17:10: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                printf('bqp');
                       ^~~~~
/usr/include/stdio.h:318:43: note: passing argument to parameter '__format' here
extern int printf (const char *__restrict __format, ...);
                                          ^
/sandbox/1/a.c:17:10: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
                printf('bqp');
                       ^~~~~
/sandbox/1/a.c:17:10: note: treat the string as an argument to avoid this
                printf('bqp');
                       ^
                       "%s", 
7 warnings generated.
/tmp/a-dfca67.o: In function `main':
a.c:(.text+0xd): undefined reference to `scanf_s'
a.c:(.text+0x2a): undefined reference to `scanf_s'
clang: error: linker command failed with exit code 1 (use -v to see invocation)