Swap Using Bitwise Operator In C Programming


#include <stdio.h>

int main()
{
    int a,b;
    printf("\nEnter the value of a  ");
    scanf("%d",&a);
    printf("\nEnter the value of b  ");
    scanf("%d",&b);
    a=a^b;
    b=a^b;
    a=a^b;
    printf("\nvalue of a : %d", a);
    printf("\nvalue of b : %d", b);
   

    return 0;
}

Comments