Question 136Asked in DSSSB TGT Computer Science, 25 Jun 2023, Shift 1 (8:30 AM)

What is the output of following C program? int main()

What is the output of following C program? #include<stdio.h> int main() { int x = 8, *y, z; y = &x; printf("%d\n", x * *y * x + *y); return 0; }
  1. A8
  2. BRuntime error
  3. C520
  4. DCompilation error
Show answerHide answer

Correct answer: (C) 520

Explanation

y points to x, so *y = 8. x * *y * x + *y = 8 × 8 × 8 + 8 = 512 + 8 = 520.

From DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 1 (8:30 AM)

This is question 136 of DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 1 (8:30 AM). 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.