标签:typedef str pre 结构体 style struct rgb type std
结构体中的位结构:
1 #include <stdio.h> 2 3 typedef struct _lar{ 4 unsigned char ucA:1; 5 unsigned char ucB:1; 6 unsigned char ucC:2; 7 unsigned char ucD:4; 8 } Lar; 9 10 int main(int argc, char **argv) 11 { 12 Lar lar; 13 lar.ucA=1; 14 lar.ucB=0; 15 lar.ucC=0; 16 lar.ucD=4; 17 printf("%c\n", lar); 18 19 lar.ucA=0; 20 lar.ucB=1; 21 lar.ucC=0; 22 lar.ucD=4; 23 printf("%c\n", lar); 24 25 char ch = ‘A‘; 26 printf("%d\n", ch); 27 28 ch >>= 1; 29 printf("%d\n", ch); 30 31 ch <<= 3; 32 printf("%d\n", ch); 33 34 return 0; 35 }
比较简单,不多说
标签:typedef str pre 结构体 style struct rgb type std
原文地址:https://www.cnblogs.com/guochaoxxl/p/14585244.html