If I want to implement the following code, would enums be appropriate?
Without getting too detailed about alternatives -- Yes.
how would I go about initialising the enum?
I typically declare an enum in C like so:
typedef enum MONDayOfWeek {
MONDayOfWeek_Undefined = 0,
MONDayOfWeek_Monday,
MONDayOfWeek_Tuesday,
MONDayOfWeek_Wednesday,
MONDayOfWeek_Thursday,
MONDayOfWeek_Friday,
MONDayOfWeek_Saturday,
MONDayOfWeek_Sunday
} MONDayOfWeek;
// in use:
MONDayOfWeek day = MONDayOfWeek_Monday;
MON
would be your library or organization's prefix. DayOfWeek
would be the enum name within the library, then the values are appended.
Although it's wordy, you tend to avoid collisions quite well.
Would it go in the header or implementation file?
In the header, if you want it to be used by multiple files, else in the implementation file.