记录详情

Compile Error

foo.c: In function 'bintodec':
foo.c:7:20: error: subscripted value is neither array nor pointer nor vector
    7 |         while (pbin[ii] != 0) {
      |                    ^
foo.c:8:44: error: subscripted value is neither array nor pointer nor vector
    8 |                 result = result * 2 + (pbin[ii] - '0')
      |                                            ^
foo.c:8:55: error: expected ';' before 'ii'
    8 |                 result = result * 2 + (pbin[ii] - '0')
      |                                                       ^
      |                                                       ;
    9 |                         ii++;
      |                         ~~                             
foo.c:4:13: warning: variable 'ii' set but not used [-Wunused-but-set-variable]
    4 |         int ii = 0;
      |             ^~
foo.c: In function 'main':
foo.c:21:62: warning: passing argument 1 of 'bintodec' makes integer from pointer without a cast [-Wint-conversion]
   21 |         printf("%s转换为十进制的结果是:%d\n", str, bintodec(str));
      |                                                              ^~~
      |                                                              |
      |                                                              char *
foo.c:3:26: note: expected 'char' but argument is of type 'char *'
    3 | long bintodec(const char pbin) {
      |               ~~~~~~~~~~~^~~~
foo.c:21:42: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
   21 |         printf("%s转换为十进制的结果是:%d\n", str, bintodec(str));
      |                                         ~^          ~~~~~~~~~~~~~
      |                                          |          |
      |                                          int        long int
      |                                         %ld
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1081 xf1-4进制转换2
比赛
2022年迎新赛(第二场)
语言
C
递交时间
2022-08-27 15:51:47
评测时间
2022-08-27 16:02:07
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes