编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#667 #996. 相似字符串 Compile Error 0 0 ms 0 K C / 482 B s230016006 2023-10-15 15:04:19
显示原始代码
#include <stdio.h>
int main() {
    int n, flag = 1;
    char a[100], b[100];
    scanf("%d", &n);
    scanf("%c", a[100]);
    scanf("%c", b[100]);
    for (int i = 0; i < 100; i++) {
        if (a[i] == 0)
            a[i] = o;
        if (a[i] == 1)
            a[i] == l;
    }
    for (int i = 0; i < 100; i++) {
        if (a[i] != b[i]) {
            flag = 0;
            break;
        }
    }
    if (flag == 1)
        printf("Yes");
    else
        printf("No");
}

编译信息

/sandbox/1/a.c:6:16: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
    scanf("%c",a[100]);
           ~~  ^~~~~~
/sandbox/1/a.c:7:16: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
    scanf("%c",b[100]);
           ~~  ^~~~~~
/sandbox/1/a.c:10:14: error: use of undeclared identifier 'o'
        a[i]=o;
             ^
/sandbox/1/a.c:12:15: error: use of undeclared identifier 'l'
        a[i]==l;
              ^
/sandbox/1/a.c:6:16: warning: array index 100 is past the end of the array (which contains 100 elements) [-Warray-bounds]
    scanf("%c",a[100]);
               ^ ~~~
/sandbox/1/a.c:4:5: note: array 'a' declared here
    char a[100],b[100];
    ^
/sandbox/1/a.c:7:16: warning: array index 100 is past the end of the array (which contains 100 elements) [-Warray-bounds]
    scanf("%c",b[100]);
               ^ ~~~
/sandbox/1/a.c:4:5: note: array 'b' declared here
    char a[100],b[100];
    ^
4 warnings and 2 errors generated.