#include <stdio.h> void main() { int i = 65; int k = 120; printf(" value of i=%d k=%d before swapping", i, k); i = i ^ k; k = i ^ k; i = i ^ k; printf("value of i=%d k=%d after swapping", i, k); }
Explanation:
find binary equivalent of i=65find binary equivalent of k=120
Then perform bitwise xor operation on each bit of i & k
i,e, i XOR k
execute all the statements and check the answer..
No comments:
Post a Comment