Assume that the array arr has been declared. In addition, assume that ARR_SIZE has been defined to be an integer that equals the number of elements in arr. Write a statement that assigns to x the value of the next to last element of the array (x has already been declared).

Assume that the array arr has been declared. In addition, assume that ARR_SIZE has been defined to be an integer that equals the number of elements in arr. Write a statement that assigns to x the value of the next to last element of the array (x has already been declared).

LANGUAGE: C++

CHALLENGE:

Assume that the array arr has been declared. In addition, assume that ARR_SIZE has been defined to be an integer that equals the number of elements in arr. Write a statement that assigns to x the value of the next to last element of the array (x has already been declared).

SOLUTION:


x=arr[ARR_SIZE-2];

Add comment