-
enums!
Hi,
I have to do this C question involving enum's which I don't understand the point of.
I have to write an array, subscripted by a suitable enumerated type for a student who works at a burger place. They have to input their own hours for each day of the week, and afterwards calculate their wage and longest day based on the fact that they get paid $4 an hour during the week and $5 at the weekends.
I could do this using an array alone, but im not allowed too... have to use an enum, can someone please help me???
Thanks!
J
-
>I could do this using an array alone, but im not allowed too...
>have to use an enum,
I think you don't quite understand the differences between an enummeration and an array. An array is a piece of memory in which you can store elements and each element can be retrieved by its index. An enummeration is a number of constants. But you can do something like this:
Code:
typedef enum
{
FALSE,
TRUE
} boolean_e;
boolean_e array [NR_OF_ELEMENTS];