Aspire Faculty ID #17006 · Topic: AMU MCA 2022 · Just now
AMU MCA 2022

What is the output of the following program? #include int main() { int i = 100, j = 300, k; j = i ^ j; i = i ^ j; j = i ^ j; printf("The values of i and j are %d, %d", i, j); return 0; }

Solution

This is the XOR swap technique. After execution, values of i and j are swapped. So output is 300, 100.

Previous 10 Questions — AMU MCA 2022

Nearest first

Next 10 Questions — AMU MCA 2022

Ascending by ID
Ask Your Question or Put Your Review.

loading...