int main() {
int a[3] = { 0x0f,0x0f,0x0f }, b[3] = {0,0,0};
int t = 0,tt;
t |= a[0] << 16;
t |= a[1] << 8;
t |= a[2];
t = t >> 3;
tt = t;
printf("0x%x
",t);
b[0] |= t >> 16;
tt &= 0xff00;
b[1] |= tt >> 8;
t &= 0xff;
b[2] |= t;
for (int j = 0; j < 3; j++)
{
printf("b[%d]=0x%x
",j,b[j]);
}
}
int a[3] = { 0x0f,0x0f,0x0f }, b[3] = {0,0,0};
int t = 0,tt;
t |= a[0] << 16;
t |= a[1] << 8;
t |= a[2];
t = t >> 3;
tt = t;
printf("0x%x ",t);
b[0] |= t >> 16;
tt &= 0xff00;
b[1] |= tt >> 8;
t &= 0xff;
b[2] |= t;
for (int j = 0; j < 3; j++)
{
printf("b[%d]=0x%x ",j,b[j]);
}
}
一周热门 更多>