记录详情

Compile Error

foo.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
    2 | search(int a[],int x,int n)
      | ^~~~~~
foo.c: In function 'search':
foo.c:5:9: warning: right-hand operand of comma expression has no effect [-Wunused-value]
    5 |  for(i=0,i<n,i++)
      |         ^
foo.c:5:17: error: expected ';' before ')' token
    5 |  for(i=0,i<n,i++)
      |                 ^
      |                 ;
foo.c:5:17: error: expected expression before ')' token
foo.c: In function 'main':
foo.c:13:10: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'char *' [-Wformat=]
   13 |  scanf("%d",&n);
      |         ~^  ~~
      |          |  |
      |          |  char *
      |          int *
      |         %hhd
foo.c:14:9: warning: right-hand operand of comma expression has no effect [-Wunused-value]
   14 |  for(i=0,i<n,i++)
      |         ^
foo.c:14:17: error: expected ';' before ')' token
   14 |  for(i=0,i<n,i++)
      |                 ^
      |                 ;
foo.c:14:17: error: expected expression before ')' token
foo.c:15:16: warning: array subscript has type 'char' [-Wchar-subscripts]
   15 |   scanf("%d ",a[i]);
      |                ^
foo.c:15:11: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
   15 |   scanf("%d ",a[i]);
      |          ~^   ~~~~
      |           |    |
      |           |    int
      |           int *
foo.c:16:10: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'char *' [-Wformat=]
   16 |  scanf("%d",&x);
      |         ~^  ~~
      |          |  |
      |          |  char *
      |          int *
      |         %hhd
foo.c:17:9: warning: passing argument 1 of 'search' from incompatible pointer type [-Wincompatible-pointer-types]
   17 |  search(a,x,n);
      |         ^
      |         |
      |         char *
foo.c:2:12: note: expected 'int *' but argument is of type 'char *'
    2 | search(int a[],int x,int n)
      |        ~~~~^~~
foo.c: In function 'search':
foo.c:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
foo.c: In function 'main':
foo.c:13:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   13 |  scanf("%d",&n);
      |  ^~~~~~~~~~~~~~
foo.c:15:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   15 |   scanf("%d ",a[i]);
      |   ^~~~~~~~~~~~~~~~~
foo.c:16:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%d",&x);
      |  ^~~~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
自测
题目
A7-4 数组的查找函数
语言
C
递交时间
2022-05-31 12:14:56
评测时间
2022-05-31 12:14:56
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes