189k views
4 votes
Assume that the vector arr has been declared. In addition, assume that VECTOR_SIZE has been defined to be an integer that equals the number of elements in arr. Write a statement that assigns the next to last element of the vector to the variable x (x has already been declared).

1 Answer

5 votes

Answer:

x=arr[VECTOR_SIZE-2];

Step-by-step explanation:

We have the vector named arr ,VECTOR_SIZE and integer x.To assign the value of next to last element of the array to the variable x which will be stored on the index VECTOR_SIZE-2 we have to use assignment operator(=) for doing that. Assignment operator assigns the value of the right of the operator to the variable on left of the operator.

User Obsidian
by
5.9k points