当前位置:网站首页>学习位段(1)
学习位段(1)
2022-06-11 21:36:00 【爱学代码的学生】
1. 什么是位段?
位段的声明和结构是类似的,有两个不同:
1.位段的成员必须是 int、unsigned int或signed int 。
2.位段的成员名后边有一个冒号和一个阿拉伯数字。
例如:
struct A
{ int a: 2;
int b: 5;
int c: 10;
int d: 30;
};
A 就是一个位段类型。
那A的大小又是多少呢?
如果没有冒号后面的数字我们可以结构体的计算方式得到16,那这个大小是呢?

我们可以发现是只有八个字节,那我们可以知道这个数字的单位都是bit。
边栏推荐
- [Part 13] source code analysis and application details of completabilefuture class [key]
- 焕新升级 | 创新,从云商店开始
- LeetCode-104-二叉树的最大深度
- RPA super automation | nongnongji and cloud expansion accelerate financial intelligent operation
- C语言实现八种排序 - 归并排序
- Software test plan
- JVM | virtual machine stack (local variable table; operand stack; dynamic link; method binding mechanism; method call; method return address)
- Leetcode-98- validate binary search tree
- Usage of esp32c3 Arduino Library
- Jenkins+allure integrated report construction
猜你喜欢

Leetcode-76- minimum covering substring

Introduction à endnotex9 et instructions pour les tutoriels de base

EndnoteX9简介及基本教程使用说明

Leetcode - 第2天

Jenkins+allure integrated report construction

How does the chief financial officer of RPA find the "super entrance" of digital transformation?

RPA+低代码助推品牌电商启新创变、重启增长

【历史上的今天】6 月 11 日:蒙特卡罗方法的共同发明者出生;谷歌推出 Google 地球;谷歌收购 Waze

如何使用事物码 SAT 查找某个 SAPGUI 屏幕字段对应的后台存储数据库表的名称试读版

RPA丨首席财务官如何找到数字化转型“超级入口”?
随机推荐
C语言实现八种排序(3)
每日一题 -- 验证回文串
网络连接正常但百度网页打不开显示无法访问此网站解决方案
Builder pattern
Leetcode-43- string multiplication
华为设备配置H-VPN
Some error reporting assemblies of cann code
华为设备配置HoVPN
Building a custom CNN model: identifying covid-19
Diary at 16:29:41 on June 9, 2022
Test plans and test cases
作为一名 ABAP 资深顾问,下一步可以选择哪一门 SAP 技术作为主攻方向?
如何使用 SAP Kyma 控制台手动发送 SAP Commerce Cloud Mock 应用暴露的事件
RPA超自动化 | 农耕记携手云扩加速财务智能化运营
Game client performance (memory) [previous]
How to create the simplest SAP kyma function
flutter系列之:flutter中常用的container layout详解
JVM | runtime data area; Program counter (PC register);
Bipartite King
JVM|虚拟机栈(局部变量表;操作数栈;动态链接;方法的绑定机制;方法的调用;方法返回地址)