JavaScript is required

What is output? #include #include int main() { int array[2][2][3]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; printf("%d", array[1][0][2]); getch(); }

A.

6

B.

7

C.

8

D.

9

Trả lời:

Đáp án đúng: C


The code initializes a 3D array `array` of size 2x2x3. The element `array[1][0][2]` is accessed. The array is initialized with values from 0 to 11 sequentially. Therefore, array[0][0][0] = 0, array[0][0][1] = 1, array[0][0][2] = 2, array[0][1][0] = 3, array[0][1][1] = 4, array[0][1][2] = 5, array[1][0][0] = 6, array[1][0][1] = 7, array[1][0][2] = 8. Thus, the value printed will be 8.

Câu hỏi liên quan