QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#350387#7933. Build PermutationMaMengQiCompile Error//C991.1kb2024-03-10 18:06:142024-03-10 18:06:14

詳細信息

answer.code: In function ‘solve’:
answer.code:4:21: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
    4 |     int* re = (int*)malloc(sizeof(int)*length);
      |                     ^~~~~~
answer.code:4:21: warning: incompatible implicit declaration of built-in function ‘malloc’
answer.code:2:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
    1 | #include<stdio.h>
  +++ |+#include <stdlib.h>
    2 |     int* solve(int length, int* array)
answer.code:42:20: warning: returning ‘int’ from a function with return type ‘int *’ makes pointer from integer without a cast [-Wint-conversion]
   42 |             return -1;
      |                    ^
answer.code: In function ‘main’:
answer.code:53:9: error: ‘i’ undeclared (first use in this function)
   53 |     for(i=0; i<n; i++){
      |         ^
answer.code:53:9: note: each undeclared identifier is reported only once for each function it appears in
answer.code:55:5: error: variable-sized object may not be initialized
   55 |     int b[n] = solve(n,a)
      |     ^~~
answer.code:56:5: error: expected ‘,’ or ‘;’ before ‘for’
   56 |     for(i=0; i<n; i++){
      |     ^~~
answer.code:56:22: error: expected ‘;’ before ‘)’ token
   56 |     for(i=0; i<n; i++){
      |                      ^
      |                      ;
answer.code:56:22: error: expected statement before ‘)’ token
answer.code:58:1: error: expected declaration or statement at end of input
   58 | }
      | ^
answer.code:58:1: error: expected declaration or statement at end of input
answer.code:51:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   51 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~