Reverse without using temporary variables(Using XOR)

Program:

#include<stdio.h>
int main()
{
int a=5,b=10;
b ^= a;
a ^= b;
b ^=a;
printf("%d %d",a,b);
return 0;
}


Output:

b a                                  
                                     

10 5                                 
                                     

Comments

Post a Comment

Popular posts from this blog

C program to print the following Pattern

c++ program to print string along the diagonals of the matrix.

Kollywood Game