
Patrick B. answered 05/19/19
Math and computer tutor/teacher
strategy is a type, so you cannot use it as a variable name....
here is code that works:
#include <stdio.h>
typedef enum _TStrategy
{
RANDOM, //0
IMMEDIATE, //1
SEARCH //2
} TStrategy;
int main()
{
TStrategy myStrategy = RANDOM;
TStrategy theStrategy = IMMEDIATE;
TStrategy aStrategy = SEARCH;
printf(" Strategy values : %d %d %d \n",myStrategy, theStrategy, aStrategy);
}
--------------------------------------------
Note that you are allowed to change the first value of the enum :
typedef enum _TStrategy
{
RANDOM=2, //2
IMMEDIATE, //3
SEARCH //4
} TStrategy;
The output will then show 2, 3, and 4