Question 32Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

What will be the output of the following code? int main() {

What will be the output of the following code? #include <stdio.h> int main() { int arr[5] = {10, 20, 30, 40, 50}; int (*p)[5] = &arr; printf("%d\n", *(*p + 3)); return 0; }
  1. A40
  2. B30
  3. C20
  4. DCompilation Error
Show answerHide answer

Correct answer: (A) 40

Explanation

p points to the whole array, so *p is arr (the address of its first element). *p + 3 points to arr[3], and dereferencing gives 40.

From DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

This is question 32 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.