/ Vijos /

记录详情

Compile Error

/in/foo.c:54:5: error: conflicting types for 'toInt'; have 'int(char)'
   54 | int toInt(char str){
      |     ^~~~~
/in/foo.c:6:5: note: previous declaration of 'toInt' with type 'int(char *)'
    6 | int toInt(char *str);
      |     ^~~~~
/in/foo.c: In function 'toInt':
/in/foo.c:56:14: warning: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Wint-conversion]
   56 | for(i=strlen(str)-1;i>=0;i--){
      |              ^~~
      |              |
      |              char
In file included from /in/foo.c:2:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'char'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
/in/foo.c:57:14: error: subscripted value is neither array nor pointer nor vector
   57 | ans+=base(str[i]-'0');
      |              ^
/in/foo.c:57:6: error: called object 'base' is not a function or function pointer
   57 | ans+=base(str[i]-'0');
      |      ^~~~
/in/foo.c:55:7: note: declared here
   55 | int i,base=1,ans=0;
      |       ^~~~
/in/foo.c: In function 'add':
/in/foo.c:64:10: warning: passing argument 1 of 'toInt' makes integer from pointer without a cast [-Wint-conversion]
   64 | if(toInt(delta)>10 || toInt(addTo)>10)
      |          ^~~~~
      |          |
      |          char *
/in/foo.c:54:16: note: expected 'char' but argument is of type 'char *'
   54 | int toInt(char str){
      |           ~~~~~^~~
/in/foo.c:64:29: warning: passing argument 1 of 'toInt' makes integer from pointer without a cast [-Wint-conversion]
   64 | if(toInt(delta)>10 || toInt(addTo)>10)
      |                             ^~~~~
      |                             |
      |                             char *
/in/foo.c:54:16: note: expected 'char' but argument is of type 'char *'
   54 | int toInt(char str){
      |           ~~~~~^~~

信息

递交者
类型
递交
题目
P1300 儿子游戏机
语言
C
递交时间
2025-12-23 23:39:10
评测时间
2025-12-23 23:39:10
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes