编程学习网为您整理以下代码实例,主要实现:C语言位域,希望可以帮到各位朋友。
#include <stdio.h>
#include <string.h>
/* define simple structure */
struct {
unsigned int wIDthValIDated;
unsigned int heightValIDated;
} status1;
/* define a structure with bit fIElds */
struct {
unsigned int wIDthValIDated : 1;
unsigned int heightValIDated : 1;
} status2;
int main( ) {
printf( "Memory size occupIEd by status1 : %d\n", sizeof(status1));
printf( "Memory size occupIEd by status2 : %d\n", sizeof(status2));
return 0;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!