This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Length of a typedef enum

I am trying to pass the length of a typedefinition to an integer by using the sizeof function. At the moment I only get the value 4 passed back no matter the number of items are in the typedef.

This is an example of what I have done:

typedef enum {Spd1_PlusEPA_Motor_Type, Spd2_PlusEPA_Motor_Type, Spd2orEPAorSiemens_Motor_Type, Var_Speed_Man_Motor_Type, Var_Speed_Aut_Motor_Type, Var_IOBlast_Motor_Type, Var_Spd_Inl_Motor_Type, Var_Spd_Outl_Motor_Type} Motor_Types;

#define Motor_Type_Len sizeof(Motor_Types)

My guess sizeof is working 100% and it has just retuned the length of Motor_Types which is 4 bytes long.

Is there another command to finding the length or have I just implemented this incorrectly?

0