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.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site