1. Home
  2. Computer Science MCQs
  3. C Programming
  4. If x = 5, what is the value of x after the statement y =…

Added 30 Nov -0001

If x = 5, what is the value of x after the statement y = x++;?

  1. 5
  2. 4
  3. 7
  4. 6 Correct answer

Correct answer

D. 6

15 views

MCQSEXAM

Explanation

The postfix operator returns the old value to y and then increments x, so x becomes 6.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C Programming MCQs

Practise all C Programming MCQs

Similar MCQs