So I really haven't used enumeration since my intro to c class and now have to for this program. I'm having trouble understanding how to go about using it.

In a header file that was given to me i have:

Code:
typedef enum { LOGON_EVT = 0, SIO_EVT, WIO_EVT, EIO_EVT, END_EVT, TIMER_EVT, SEGFAULT_EVT, ADRFAULT_EVT, NUM_EVENTS } event_type;


And i want to use it in a get_event_id function.

How do I access this properly though?


I need to compare a char* that will be the first half of each of those strings (LOGON, SIO, WIO, EIO, and so on)

then if they are equal return the value that it represents.

this is the best i can come up with but it gives me a syntax error before event_type:

Code:
for(j =0; j<NUM_EVENTS; j++)
            {
                    if(event_name == event_type[j])
                    {
                       return j;
                    }
                    else j++;
                    
            }


also while im at it, if i just strcmp LOGON with LOGON_EVT how can i know that is a match? or should i concatenate _EVT onto each one then compare?