struct
{
unsigned int widthValidated;
unsigned int heightValidated;
} status;
struct
{
unsigned int widthValidated : ;
unsigned int heightValidated : ;
} status;
#include <stdio.h>
#include <string.h> /* 定义简单的结构 */
struct
{
unsigned int widthValidated;
unsigned int heightValidated;
} status1; /* 定义位域结构 */
struct
{
unsigned int widthValidated : ;
unsigned int heightValidated : ;
} status2; int main( )
{
printf( "Memory size occupied by status1 : %d\n", sizeof(status1));
printf( "Memory size occupied by status2 : %d\n", sizeof(status2)); return ;
}
struct
{
unsigned int age : ;
} Age;
#include <stdio.h>
#include <string.h> struct
{
unsigned int age : ;
} Age; int main( )
{
Age.age = ;
printf( "Sizeof( Age ) : %d\n", sizeof(Age) );
printf( "Age.age : %d\n", Age.age ); Age.age = ;
printf( "Age.age : %d\n", Age.age ); Age.age = ; // 二进制表示为 1000 有四位,超出
printf( "Age.age : %d\n", Age.age ); return ;
}

吴裕雄--天生自然C语言开发:位域的更多相关文章

  1. 吴裕雄--天生自然 R语言开发学习:R语言的安装与配置

    下载R语言和开发工具RStudio安装包 先安装R

  2. 吴裕雄--天生自然C语言开发:结构体

    struct tag { member-list member-list member-list ... } variable-list ; struct Books { ]; ]; ]; int b ...

  3. 吴裕雄--天生自然 R语言开发学习:数据集和数据结构

    数据集的概念 数据集通常是由数据构成的一个矩形数组,行表示观测,列表示变量.表2-1提供了一个假想的病例数据集. 不同的行业对于数据集的行和列叫法不同.统计学家称它们为观测(observation)和 ...

  4. 吴裕雄--天生自然 R语言开发学习:模块\包的安装命令

    install.packages('模块包名称') 或者 install.packages('模块包名称',repos='http://cran.us.r-project.org')

  5. 吴裕雄--天生自然 R语言开发学习:集成开发环境\工具RStudio的安装与配置

  6. 吴裕雄--天生自然C语言开发:错误处理

    #include <stdio.h> #include <errno.h> #include <string.h> extern int errno ; int m ...

  7. 吴裕雄--天生自然C语言开发:强制类型转换

    #include <stdio.h> int main() { , count = ; double mean; mean = (double) sum / count; printf(& ...

  8. 吴裕雄--天生自然C语言开发:文件读写

    #include <stdio.h> int main() { FILE *fp = NULL; fp = fopen("/tmp/test.txt", "w ...

  9. 吴裕雄--天生自然C语言开发: 输入 & 输出

    #include <stdio.h> int main() { ; printf("Number = %d", testInteger); ; } #include & ...

随机推荐

  1. vue项目配置多入口多出口【转载】

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/localhost_1314/article ...

  2. vue中的axios请求

    1.get请求 // get this.$axios.get('请求路径') .then(function (response) { console.log(response); // 成功 }) . ...

  3. Python Email发送,通知业务完成

    Email 发送 #!/usr/bin/python # -*- coding: UTF-8 -*- import base64 import smtplib from email.mime.text ...

  4. c 循环左移

    char b[11] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; const int iShift = 4; for (int j = ...

  5. BZOJ 4084 [Sdoi2015]双旋转字符串

    题解:hash 至今不会unsigned long long 的输出 把B扔进map 找A[mid+1][lenA]在A[1][mid]中的位置 把A[1][mid]贴两遍(套路) 枚举A[mid+1 ...

  6. js获取指定日期n天之后的日期

    function addDays(date, days,seperator='-') { let oDate = new Date(date).valueOf(); let nDate = oDate ...

  7. Python语言基础与应用 (P23)上机练习:容器类型操作(未完待续)

    上机练习:容器类型操作〉 列表.元组基本操作+, *, len(), [], in Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 ...

  8. github 新建库,提交命令

    Command line instructions You can also upload existing files from your computer using the instructio ...

  9. JavaScript学习总结(三)

    在学习完了基本的内容之后,我们来学习一下JavaScript中的对象部分以及如何自定义对象的问题. String对象 创建字符串的方式共有两种: 方式1:new String("内容&quo ...

  10. 1. react 编程实践 俄罗斯方块-需求分析

    1. 需求分析 俄罗斯方块的要素 界面展示 定时刷新 键盘响应 方块模型 游戏规则 俄罗斯方块 比 "电商购物车" 好在哪? 业务比较简单, 人人都了解, 不需要过多前置知识 技术 ...