Consider the following declaration int values 3 2 1 4 3 2 0
Consider the following declaration:
int values[] = {3, -2, 1, 4, -3, 2, 0};
How do we refer to the last element in array values?
A. last(values)
B. values[6]
C. values[5]
D. values[7]
Solution
B. values[6] is the option to refer the last element in array values which contains {3,-2,1,4,-3,2,0} values.
the array contains 7 elements .
In programming array starts with 0 and ends with n-1. so here the last element index value is 6. So that values[6] is the option to refer the last element in the array.
![Consider the following declaration: int values[] = {3, -2, 1, 4, -3, 2, 0}; How do we refer to the last element in array values? A. last(values) B. values[6] C. Consider the following declaration: int values[] = {3, -2, 1, 4, -3, 2, 0}; How do we refer to the last element in array values? A. last(values) B. values[6] C.](/WebImages/44/consider-the-following-declaration-int-values-3-2-1-4-3-2-0-1137765-1761609413-0.webp)