C Übung Beispiel 51
100 Fälle von klassischen C - Sprache
Thema: Lernen bitweise zu verwenden und &.
Programmanalyse: 0 0 = 0; 0 & 1 = 0; 1 & 0 = 0; 1 & 1 = 1.
Source Code:
// 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; }
Das obige Beispiel Ausgabe lautet:
a & b(decimal) 为 3 a & b(decimal) 为 3