My Subject Blog

C Program Swapping using Bitwise Operator

/* 
C Program doing Swapping using Bitwise Operator 
*/

#include <stdio.h>

int main() 
{
int i=10,j=20;
printf("\n Before Swapping : i =%d j=%d",i,j);
i^=j^=i^=j;
printf("\n After Swapping : i =%d j=%d",i,j);
return 0;
}

Comments

Most Visited Post

C Program to Find Largest Odd Number from Array

Followers