MIPI_BaseC_WebinarFRTK/23_Seminar10/03_bit_field_p11.c

16 lines
269 B
C
Raw Permalink Normal View History

2024-11-13 09:22:28 +03:00
#include <stdio.h>
struct point
{
unsigned char x:5; // 0-31
unsigned char y:3; // 0-7
};
int main(void)
{
struct point center = {0, 5};
center.x = 2;
printf("x=%d y=%d size=%llu \n", center.x, center.y,sizeof(center)); // x=2 y=5
return 0;
}