JavaScript is required

What is output?
Media VietJack

A.
6
B.
7
C.
8
D.
9
Trả lời:

Đáp án đúng: C


The code initializes an integer array `arr` with values {1, 2, 3, 4, 5}. It then initializes an integer pointer `ptr` to point to the first element of the array. The expression `*(ptr + 3)` accesses the element at index 3 of the array (which is 4). The expression `*ptr` accesses the element at index 0 of the array (which is 1). Therefore, `*(ptr + 3) + *ptr` evaluates to 4 + 1 = 5. The code then prints the value of `*(ptr + 3)`, which is 4. Thus the output will be 54, since no endl is present.

Câu hỏi liên quan