C++ Foundation —— (05) C++14 enum (Not translated)
»
    在浙江的少年时代没有接触到过“枚举”这个词。第一次接触到“枚举”是到大学后的C++课程中。课程中,不解其意,唯记其用。

    多年后,已是囧志中年,看到了“不胜枚举”这个词,知道了这个词的意思,也就是不能够一一举例出来的意思。恍然明白了C++中枚举的意思就是:一枚一枚地全部列举出来的意思。在C++中,也就是列举一个int型变量的可用取值。

枚举类型的用法:
enum Vehicle{
    CAR=0,
    TRUCK=1,
    TRAIN=2,
    FREIGHTER=3,
};
printf("%d",sizeof(Vehicle));
打印结果为:4
«
--Alex.Zhang
--www.v-signon.com Learningers Co-Encouraged
Back
Personal Art: www.up-task.com Unit: Individual
中文 Русский 京ICP备19038994号-2
If the content on this website infringes upon your any rights, please contact me at 1307776259@qq.com for removal