当前位置:网站首页>C language: enumerating knowledge points summary
C language: enumerating knowledge points summary
2022-07-29 04:16:00 【White night gxw】
Use the enumeration type declaration symbol name to represent the integer constant . Use enum keyword , You can create a new “ type ” And specify the values he can have ( actually ,enum Constant is int type , therefore , As long as it can be used int Type, you can use enumeration type ). The purpose of enumerating types is to improve the readability of programs .
Enumeration type
You can use enumeration type declaration symbols to represent integer constants . Use enum keyword , You can create a new type and specify the values it can have ( actually ,enum Constant is int type , therefore , As long as it can be used int Type, you can use enumeration type ). The purpose of enumerating types is to improve the readability of programs .
enum spectrum { red,orange,yellow,green,blue,violet}; enum spectrum color;
int c; color = blue; if(color==red) ...; for(color=red;color<=violet;color++) ...;
enum Constant
From the perspective of Technology ,red,blue Wait until these enumerators are int Constant of type . When you declare an array , You can use enumeration constants to represent the size of the array , stay switch Statement can use enumeration constants as labels .Default value for enumeration
By default , The values in the enumeration list are all from 0 Start .
In the declaration of enumeration , You can specify integer values for enumeration constants
enum feline { low=100,med=200,high=300};
If you assign a value to only one enumeration constant , There is no assignment to the following enumeration constant , Then the following constants will be given subsequent values .
enum feline { cat,lmj=100,jijia,lop};
that cat The value of is 0,lmj The value of is 100,jijia The value of is 101,lop The value of is 102.
边栏推荐
- 安装postgis时报找不到“POSTGIS_VERSION”这个函数
- 小程序:区域滚动、下拉刷新、上拉加载更多
- Don't stick to it for 68 days. Baboons eat bananas
- MySQL gets the maximum value record by field grouping
- 你真的会写Restful API吗?
- 数据源是SQL server ,我要配置日期字段 updateDate 最后两天日期的增量数据,做增
- [Openstack] keystone,nova
- 不会就坚持71天吧 链表排序
- Solution: module 'xlrd' has no attribute 'open_ Error reporting of workbook '
- 对一个元素使用多种变形的方法
猜你喜欢
Beginner: array & String
Some problems about pointers
Not for 60 days, magical dictionary
The principle of inverse Fourier transform (IFFT) in signal processing
Problems encountered in vscode connection SSH
Function pointer and callback function
开课!看smardaten如何分解复杂业务场景
通过js来实现一元二次方程的效果,输入a,b,c系数后可计算出x1和x2的值
不会就坚持69天吧 合并区间
Locally call tensorboard and Jupiter notebook on the server (using mobaxterm)
随机推荐
Mmdetection preliminary use
“蔚来杯“2022牛客暑期多校训练营1 J Serval and Essay(启发式合并)
Multi card training in pytorch
对一个元素使用多种变形的方法
Solution: module 'xlrd' has no attribute 'open_ Error reporting of workbook '
不会就坚持69天吧 合并区间
不会就坚持59天吧 替换单词
全屋WiFi方案:Mesh路由器组网和AC+AP
“蔚来杯“2022牛客暑期多校训练营2 H
C语言:枚举知识点总结
Shielding ODBC load balancing mode in gbase 8A special scenarios?
C语言力扣第61题之旋转链表。双端队列与构造循环链表
Why do I delete the original record (OP d) and then add a new one in Kafka when I update MySQL data
"Weilai Cup" 2022 Niuke summer multi school training camp 2H
Target detection learning process
[kvm] install KVM
Copy products with one click from Taobao, tmall, 1688, wechat, jd.com, Suning, taote and other platforms to pinduoduo platform (batch upload baby details Interface tutorial)
顺序表和链表
编译与链接
Asp. Net MVC, how can the controller in the folder jump to the controller in the root directory?