Im working writing a program that outputs to a dos console. The even output comes out as a big negative number.

The code is here:

Thanks for any helpCode:int * even (int *list, int size, int & esize) //Pre: size > 0 //Post: return base address of new dynamic array containing even values // from list array and set esize to the size of the new array { // Solving for the number of the Even Numbers for (int i=0; i<size; i++) { if (list[i] % 2 == 0) esize++; } int *leven = new int[esize]; //adding the even numbers into the array to be returned for (int j = 0; j < size; j++) { if (list[j] % 2 ==0 ) { for(int k = 0; k < esize; k++) list[j] = leven [k]; } } return leven; }