ตัวอย่างการใช้สิทธิ 51 C
หัวข้อ: เรียนรู้การใช้ค่าที่เหมาะสมและ &
การวิเคราะห์โปรแกรม: 0 & 0 = 0; 0 & 1 = 0; 1 & 0 = 0; 1 & 1 = 1
รหัสที่มา:
// 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("a & b(decimal) 为 %d \n",b); b&=7; printf("a & b(decimal) 为 %d \n",b); return 0; }
เอาท์พุทตัวอย่างข้างต้นคือ
a & b(decimal) 为 3 a & b(decimal) 为 3