Aspire Faculty ID #16780 · Topic: AMU MCA 2025 · Just now
AMU MCA 2025

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$.

Previous 10 Questions — AMU MCA 2025

Nearest first

Next 10 Questions — AMU MCA 2025

Ascending by ID
Ask Your Question or Put Your Review.

loading...