C Programming - XOR Bitwise Operation

后端 未结 6 1144
傲寒
傲寒 2020-12-07 06:01

What operation does the following ‘C’ statement perform?

star = star ^ 0b00100100;

(A) Toggles bits 2 and 5 of

6条回答
  •  一整个雨季
    2020-12-07 06:30

    XOR operator returns 0 if both inputs are same otherwise returns 1 if both inputs are different.For Example the Given Truth Table :-

    • a=1 b=1 => a^b=0,
    • a=0 b=0 => a^b=0,
    • a=0 b=1 => a^b=1,
    • a=1 b=0 => a^b=1.

提交回复
热议问题