ตัวอย่างการใช้สิทธิ 53 C
หัวข้อ: เรียนรู้การใช้ Bitwise XOR ^
การวิเคราะห์โครงการ: 0 ^ 0 = 0; 0 ^ 1 = 1; 1 ^ 0 = 1; 1 ^ 1 = 0
รหัสที่มา:
// Created by www.w3big.com on 15/11/9. // Copyright © 2015年 本教程. All rights reserved. // #include <stdio.h> int main() { int a,b; a=077; b=a^3; printf("b 的值为 %d \n",b); b^=7; printf("b 的值为 %d \n",b); return 0; }
เอาท์พุทตัวอย่างข้างต้นคือ
b 的值为 60 b 的值为 59