Part 5 of 5 in Writing functions  

Boundary by harsha_s

Problem statement

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.

To try out your code

Sign in

Sign up