Submission #19192

# Submission time Handle Problem Language Result Execution time Memory
19192 2016-02-20T03:14:46 Z anrhks1212 최댓값 (tutorial2) C++
Compilation error
0 ms 0 KB
#include <iostream>
using namespace std;
int GetMax(int N, int *A);
int main()
{
	int N;
	cin >> N;
	int *A = new int[N - 1];
	cout<<GetMax(N, A);

    return 0;
}
int GetMax(int N, int *A)
{
	int i, size = 0, max;

	for (i = 0; i<N; i++)
	{
		cin >> A[i];
	}

	max = A[0];
	for (i = 0; i < N - 1; i++)
	{
		if (max < A[i + 1])
		{
			max = A[i + 1];
		}
	}
	return max;

Compilation message

tutorial2.cpp: In function ‘int GetMax(int, int*)’:
tutorial2.cpp:15:9: warning: unused variable ‘size’ [-Wunused-variable]
  int i, size = 0, max;
         ^
tutorial2.cpp:30:12: error: expected ‘}’ at end of input
  return max;
            ^