记录详情

Compile Error

foo.c: In function 'main':
foo.c:6:15: warning: multi-character character constant [-Wmultichar]
    6 |         scanf('%d',&i);
      |               ^~~~
foo.c:6:15: warning: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion]
    6 |         scanf('%d',&i);
      |               ^~~~
      |               |
      |               int
In file included from foo.c:1:
/nix/store/3w4yrspgcx1z9wi18rv0hbap4jjlhx4c-glibc-2.37-8-dev/include/stdio.h:421:42: note: expected 'const char * restrict' but argument is of type 'int'
  421 | extern int scanf (const char *__restrict __format, ...) __wur;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
foo.c:7:16: warning: right-hand operand of comma expression has no effect [-Wunused-value]
    7 |         for(a=1,i>0&&i>=a,a++);
      |                ^
foo.c:7:30: error: expected ';' before ')' token
    7 |         for(a=1,i>0&&i>=a,a++);
      |                              ^
      |                              ;
foo.c:7:30: error: expected expression before ')' token
foo.c:7:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    7 |         for(a=1,i>0&&i>=a,a++);
      |         ^~~
foo.c:8:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    8 |         {
      |         ^
foo.c:9:11: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    9 |           if(i==1||i==2);
      |           ^~
foo.c:10:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   10 |                  printf(i);
      |                  ^~~~~~
foo.c:10:25: warning: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   10 |                  printf(i);
      |                         ^
      |                         |
      |                         int
/nix/store/3w4yrspgcx1z9wi18rv0hbap4jjlhx4c-glibc-2.37-8-dev/include/stdio.h:356:43: note: expected 'const char * restrict' but argument is of type 'int'
  356 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
foo.c:11:12: error: 'else' without a previous 'if'
   11 |            else
      |            ^~~~
foo.c:12:29: error: expected ';' before '}' token
   12 |                    sum=sum+a
      |                             ^
      |                             ;
   13 |         }
      |         ~                    
foo.c:15:24: warning: multi-character character constant [-Wmultichar]
   15 |                 printf('%d',sum)
      |                        ^~~~
foo.c:15:24: warning: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   15 |                 printf('%d',sum)
      |                        ^~~~
      |                        |
      |                        int
/nix/store/3w4yrspgcx1z9wi18rv0hbap4jjlhx4c-glibc-2.37-8-dev/include/stdio.h:356:43: note: expected 'const char * restrict' but argument is of type 'int'
  356 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
foo.c:15:33: error: expected ';' before 'printf'
   15 |                 printf('%d',sum)
      |                                 ^
      |                                 ;
   16 | 
   17 |     printf("hello, world\n");
      |     ~~~~~~                       
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
A2-3 循环结构入门:斐波拉契数列的和
比赛
2023年新生赛(第一场)
语言
C
递交时间
2023-08-15 16:09:13
评测时间
2023-08-15 16:09:13
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes