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?
Thanks for the info.
I had a feeling that was the case. I am pretty new to C programing and wanted to be sure there wasnt an actual command rather than using a work around.