All mock tests are FREE till 31 December — register to save your progress
Unit 3 · Programming Languages and Computer Graphics Paper 2 CS · December 2022 Shift 1

Given
int arr[3][4][2] = {{{2,4},{7,8},{3,4},{5,6}}, {{7,6},{3,4},{5,3},{2,3}}, {{8,9},{7,2},{3,4},{5,1}}};
Which one of the following can be used to refer to the element 1 in the above 3-D array?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. *(*(*(arr + 2) + 3) + 1)

Explanation

The value 1 is arr[2][3][1] (last pair {5, 1}), which is *(*(*(arr + 2) + 3) + 1).

More Programming Languages and Computer Graphics questions