记录详情

Compile Error

foo.c: In function 'main':
foo.c:6:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'scanf'
    6 |         scanf('%d%d',&a,&b);
      |         ^~~~~
foo.c:6:15: warning: multi-character character constant [-Wmultichar]
    6 |         scanf('%d%d',&a,&b);
      |               ^~~~~~
foo.c:6:23: error: 'a' undeclared (first use in this function)
    6 |         scanf('%d%d',&a,&b);
      |                       ^
foo.c:6:23: note: each undeclared identifier is reported only once for each function it appears in
foo.c:6:26: error: 'b' undeclared (first use in this function)
    6 |         scanf('%d%d',&a,&b);
      |                          ^
foo.c:6:15: warning: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion]
    6 |         scanf('%d%d',&a,&b);
      |               ^~~~~~
      |               |
      |               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:8:38: error: expected ';' before 'break'
    8 |                 case '+': printf(a+b)break;
      |                                      ^~~~~
      |                                      ;
foo.c:9:13: error: case label not within a switch statement
    9 |             case '-': printf(a-b)break;
      |             ^~~~
foo.c:9:34: error: expected ';' before 'break'
    9 |             case '-': printf(a-b)break;
      |                                  ^~~~~
      |                                  ;
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
3-5 计算器
比赛
2023年新生赛(第一场)
语言
C
递交时间
2023-08-15 16:26:49
评测时间
2023-08-15 16:26:49
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes