'how does the bitwise operator compare the binary in c?

How does the bitwise operator compare the binary?

long num1 = 22; //00010110
long num2 = 21; //00010101

if ((num1 ^ num2) == 0) {
    printf("its equal\n");
    printf("%li\n", num1);
    printf("%li\n", num2);
}
else {
    printf("not equal\n");
}
    
//$> not equal

Does ^ XOR operator do a for loop for each bit?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source