Submission #717848

#TimeUsernameProblemLanguageResultExecution timeMemory
717848EntityPlantt최댓값 (tutorial2)C++14
Compilation error
0 ms0 KiB
#include <cstdio> #include <algorithm> int main() { int n, i = 0; scanf("%d", &n); int a[n]; while (i < n) { scanf("%d", a + i++); } printf("%d", std::max_element(a, a + n)); return 0; }

Compilation message (stderr)

tutorial2.cpp: In function 'int main()':
tutorial2.cpp:10:12: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int*' [-Wformat=]
   10 |   printf("%d", std::max_element(a, a + n));
      |           ~^   ~~~~~~~~~~~~~~~~~~~~~~~~~~
      |            |                   |
      |            int                 int*
      |           %n
tutorial2.cpp:5:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
tutorial2.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d", a + i++);
      |     ~~~~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccDaR44z.o: in function `main':
tutorial2.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccKGSvGy.o:grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccKGSvGy.o: in function `main':
grader.cpp:(.text.startup+0xaa): undefined reference to `GetMax(int, int*)'
collect2: error: ld returned 1 exit status