You can use it like that on C++, In C, you have to write it like this.
typedef enum {RANDOM, IMMEDIATE, SEARCH} strategy;
strategy my_strategy = IMMEDIATE;
And personally, it is easier to manage the type and variable, so I would recommend using it as below
typedef enum {RANDOM, IMMEDIATE, SEARCH} strategy_type;
strategy_type my_strategy = IMMEDIATE;
© 2024 OneMinuteCode. All rights reserved.