Submission #145805

#TimeUsernameProblemLanguageResultExecution timeMemory
145805wesley2003짝수 정렬 (tutorial3)C++14
Compilation error
0 ms0 KiB
#include <stdio.h>
#include <assert.h>
#include <malloc.h>
#include <algorithm>
using namespace std;
int GetMax(int N,int *A){
	int arr[20]={0,},cnt=0;
	for(int i=0;i<N;i++){
		if(A[i]%2==0){
			arr[cnt]=A[i];
			cnt++;	
		} 
	}
	sort(arr,arr+cnt);
	return arr;
}

Compilation message (stderr)

tutorial3.cpp: In function 'int GetMax(int, int*)':
tutorial3.cpp:15:9: error: invalid conversion from 'int*' to 'int' [-fpermissive]
  return arr;
         ^~~
tutorial3.cpp:7:6: warning: address of local variable 'arr' returned [-Wreturn-local-addr]
  int arr[20]={0,},cnt=0;
      ^~~