Given that an array of int named a has been declared, and that the integer variable n contains the number of elements of the array a, assign -1 (minus one) to the last element in a.

Given that an array of int named a has been declared, and that the integer variable n contains the number of elements of the array a, assign -1 (minus one) to the last element in a.

LANGUAGE: C++

CHALLENGE:

Given that an array of int named a has been declared, and that the integer variable n contains the number of elements of the array a, assign -1 (minus one) to the last element in a.

SOLUTION:

a[n-1] = -1;

Add comment