枚举类型
相关知识
1 | 1.不能直接对枚举变量赋整数值,需要将整数强制性转换 |
定义枚举类型和声明枚举变量
先定义枚举类型,在定义枚举变量
1 |
|
定义枚举类型的同时,声明枚举变量
1 |
|
不定义枚举类型,直接定义枚举变量
1 |
|
枚举元素连续的枚举变量可以遍历
1 |
|
在switch中的使用
1 |
|
将整型转换成枚举
1 |
|
用枚举元素作判断
1 |
|
1 | 1.不能直接对枚举变量赋整数值,需要将整数强制性转换 |
1 | # include <stdio.h> |
1 | # include <stdio.h> |
1 | # include <stdio.h> |
1 | # include <stdio.h> |
1 | #include <stdio.h> |
1 | #include <stdio.h> |
1 | #include <stdio.h> |
本文标题:C语言-枚举类型
文章作者:TTYONG
发布时间:2022年10月09日 - 18:10
最后更新:2022年10月09日 - 18:10
原始链接:http://tianyong.fun/C%E8%AF%AD%E8%A8%80-%E6%9E%9A%E4%B8%BE%E7%B1%BB%E5%9E%8B.html
许可协议: 转载请保留原文链接及作者。
微信支付
支付宝