Tuesday 24 July 2012

swapping of of 2 integers using bitwise XOR operator

swapping of of 2 integers using bitwise XOR operator.
/*Program to swap the values of 2 integers using bitwise XOR operator*/
#include
void main()
{
int value1, value2;
printf("Enter the values of two integers:\n");
scanf("%d %d",&value1,&value2);
printf("\n-----------Before Swapping-------------");
printf("\nBefore swapping the values of variables are:\n");
printf("Value1=%d \nValue2=%d",value1,value2);
value1= value1^value2;value2= value1^value2;value1= value1^value2;
printf("\n\n\n-----------After Swapping-------------");
printf("\nAfter swapping the values of variables are:\n");
printf("Value1=%d \nValue2=%d",value1,value2);
}
Bitwise XOR
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: