Your function is given an array of numbers (and its length in C/C++). Return a new array with exactly 2 elements: the first element of the given array and the last element of the given array.
In C/C++, You cannot create array as a local variable and return it. You need to use malloc or new operator to create it in dynamic memory.