Hello
I need help to understand use of enum in c programming . enum consist set of constant integer, Using the enum keyword, we can declare an enumeration type with using the enumeration tag and a list of named integer. following example describe declaration of enum in c programming
I think if we do not assign the value to the enumeration constant then compiler automatically assign the 0 to the first member of the list and increase these value by 1. compiler assign first 0 to constant member of enumeration list exampe task_1=0, than value will increase by 1 task_2=1 and task_3=2
when do we use enum in program and what does following program?
I need help to understand use of enum in c programming . enum consist set of constant integer, Using the enum keyword, we can declare an enumeration type with using the enumeration tag and a list of named integer. following example describe declaration of enum in c programming
Code:
enum task
{
task_1,
task_2,
task_3
}
when do we use enum in program and what does following program?
Code:
typedef enum
{
task_1 =0,
task_2,
task_3
}my_state_t;
my_task_t task = task_1;
Last edited: