Submission #148352

#TimeUsernameProblemLanguageResultExecution timeMemory
148352sg1774최댓값 (tutorial2)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; GetMax(int n, int a[]) { int s=0; for(int i=0;i<n;i++) s=max(s,a[i]); printf("%d",s); } int main() { int arr[200],z; scanf("%d",&z); for(int i=0;i<z;i++) scanf("%d",&arr[i]); GetMax(z,arr); return 0; }

Compilation message (stderr)

tutorial2.cpp:3:22: error: ISO C++ forbids declaration of 'GetMax' with no type [-fpermissive]
 GetMax(int n, int a[])
                      ^
tutorial2.cpp: In function 'int GetMax(int, int*)':
tutorial2.cpp:8:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
tutorial2.cpp: In function 'int main()':
tutorial2.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&z);
     ~~~~~^~~~~~~~~
tutorial2.cpp:14:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<z;i++) scanf("%d",&arr[i]);
                          ~~~~~^~~~~~~~~~~~~~