1 #include <stdio.h> 2 3 int main() 4 { 5 unsigned char a = 0xaa, b = 0; 6 char i = 0; 7 for (i = 0; i < 8; i++) 8 { 9 b |= (((a >> i) & 0x01) << (7 - i)); 10 } 11 printf("b = 0x%x ", b); 12 return 0; 13 }