Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



When the following code is executed, what will be the value of $x$ and $y$?
int x = 1, y = 0;
y = x++;





Solution

Post-increment assigns old value of $x$ to $y$, then increments $x$. So $y = 1$, $x = 2$.


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...