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. 关于indexOf的用法

     var fullTaskName = this.form.taskName;       var index=fullTaskName.lastIndexOf("-");     ...

  2. redis(六)---- 简单延迟队列

    延迟队列的应用场景也很常见,例如:session的超时过期.自动取消未付款订单等等.redis中有一种数据结构叫做zset,即有序集合.元素类型为String类型,且元素具有唯一性不能重复,每个元素可 ...

  3. Tensorflow学习教程------代价函数

    Tensorflow学习教程------代价函数   二次代价函数(quadratic cost): 其中,C表示代价函数,x表示样本,y表示实际值,a表示输出值,n表示样本的总数.为简单起见,使用一 ...

  4. 用户使用API函数对创建的文件进行读写操作

    HANDLE handle; //定义文件句柄 ]; //定义缓冲区 int i; //接收实际操作的字节数 CString str; //定义字符串变量 handle = ::CreateFile( ...

  5. SHIDOU

    1. arp    i  指定网卡     a 查看arp表,显示主机名称和ip      n 查看arp表,并且用ip显示而不是主机名称   2. 119 ~/M2/image-installer- ...

  6. C++ STD Gems01

    本文是根据油管大神的C++标准库课程的一个学习笔记,该课程主要介绍c++标准库中一些非常有用并且代码经常用到的工具. copy .copy_backward .copy_n .copy_if.swap ...

  7. 6.44 以元素值为x的节点为根的子树的深度(递归实现)

    题目:求二叉树中以元素值为x的节点为根的子树的深度 #include<cstdio> #include<malloc.h> typedef struct btree{ char ...

  8. 吴裕雄--天生自然 JAVASCRIPT开发学习: 表单

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> ...

  9. linux下的hashpump安装

    hashpump是linux上的一个进行hash长度拓展攻击的工具 安装: git clone https://github.com/bwall/HashPump apt-get install g+ ...

  10. POJ 1850:Code 组合数学

    Code Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 8710   Accepted: 4141 Description ...