Submission #14079

#TimeUsernameProblemLanguageResultExecution timeMemory
14079sleep4725최댓값 (tutorial2)C11
Compilation error
0 ms0 KiB
#include<stdio.h> #include<stdlib.h> int main(void) { int i; int a; int max = 0; scanf("%d", &a); int* arr = NULL; arr = (int*)malloc(sizeof(int)*a); for (i = 0; i < a; i++) { scanf("%d", &arr[i]); } max = arr[0]; for (i = 1; i < a; i++) { if (max < arr[i]) { max = arr[i]; } } printf("%d\n", max); return 0; }

Compilation message (stderr)

tutorial2.c: In function ‘main’:
tutorial2.c:8:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &a);
  ^
tutorial2.c:13:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &arr[i]);
   ^
/tmp/ccKWk84j.o: In function `main':
tutorial2.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccxibryW.o:grader.c:(.text.startup+0x0): first defined here
/tmp/ccxibryW.o: In function `main':
grader.c:(.text.startup+0x97): undefined reference to `GetMax'
collect2: error: ld returned 1 exit status