Submission #717849

# Submission time Handle Problem Language Result Execution time Memory
717849 2023-04-02T16:14:08 Z EntityPlantt 최댓값 (tutorial2) C++14
Compilation error
0 ms 0 KB
#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

tutorial2.cpp: In function 'int main()':
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/ccRZK5jd.o: in function `main':
tutorial2.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccVdy6mb.o:grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccVdy6mb.o: in function `main':
grader.cpp:(.text.startup+0xaa): undefined reference to `GetMax(int, int*)'
collect2: error: ld returned 1 exit status