제출 #9144

#제출 시각아이디문제언어결과실행 시간메모리
9144carl111최댓값 (tutorial2)C11
컴파일 에러
0 ms0 KiB
#include <stdio.h> int GetMax(int m, int arr2[]) { int i; int swap; swap=arr2[0]; for(i=0; i<m; i++) { if(arr2[i]>swap) swap = arr2[i]; } return swap; } int main(void) { int n,i; int arr[100]; scanf("%d",&n); for(i=0; i<n; i++) arr[i]=0; for(i=0; i<n; i++) { scanf("%d",arr[i]); } i=GetMax(n,arr); printf("%d",i); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

tutorial2.c: In function 'main':
tutorial2.c:25:9: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat]
tutorial2.c:20:10: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
tutorial2.c:25:14: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
/tmp/ccZdbwkl.o: In function `main':
tutorial2.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccYyjfuX.o:grader.c:(.text.startup+0x0): first defined here
collect2: ld returned 1 exit status