📜  如何使用按位运算符进行交换 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:55.288000             🧑  作者: Mango

代码示例1
#include
void main()
{
    int a,b;
    printf("Enter the value of a and b: ");
    scanf("%d %d", &a, &b);
    a = a^b;
    b = b^a;
    a = a^b;
    printf("Value of a is: %d\n", a);
    printf("Value of b is: %d\n", b);
}