How to declare strings in enum in C

Posted by Sridevi on Stack Overflow See other posts from Stack Overflow or by Sridevi
Published on 2010-04-20T09:14:44Z Indexed on 2010/04/20 9:23 UTC
Read the original article Hit count: 160

Filed under:
|
|

Hello,

typedef enum testCaseId
{
   "TC-HIW-0019" = 0,        
   "TC-HIW-0020",
   "TC-HIW-0021"     
} testCaseId;

I need my test cases to be represented in enum. In my test function, I need to switch between the test cases like:

void testfunc(uint8_t no)
{  
    switch(no)
    {
        case 0:
        case 1:
        default:
    }
}

So can anyone help on how to use enum to declare strings.

© Stack Overflow or respective owner

Related posts about string

Related posts about enum