Submission #13692

#TimeUsernameProblemLanguageResultExecution timeMemory
13692taehoon1018최댓값 (tutorial2)C++98
Compilation error
0 ms0 KiB
#include <stdio.h> int GetMax(int* p,int n) { int i,max; max = *p; for(i=0;i<n;i++) { if(*(p+i)>*p) max = *(p+i); } return max; } int main() { int A[10]; int i; int n, max; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d", A+i); } max = GetMax(A,n); printf("%d", max); return 0; }

Compilation message (stderr)

tutorial2.cpp: In function ‘int main()’:
tutorial2.cpp:24:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
                 ^
tutorial2.cpp:28:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", A+i);
                     ^
/tmp/cch5AXM6.o: In function `main':
tutorial2.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccBaFtYh.o:grader.cpp:(.text.startup+0x0): first defined here
/tmp/ccBaFtYh.o: In function `main':
grader.cpp:(.text.startup+0x97): undefined reference to `GetMax(int, int*)'
collect2: error: ld returned 1 exit status