string representation of enum values

Posted by robUK on Stack Overflow See other posts from Stack Overflow or by robUK
Published on 2010-03-30T06:56:19Z Indexed on 2010/03/30 7:03 UTC
Read the original article Hit count: 255

Filed under:

Hello,

gcc 4.4.2 c89

I have the following enum:

enum drop_options_e
{
    drop_ssm,
    drop_snm,
    drop_ssb
};

I am just wondering that is the best way to get the string representation value from the enum.

So basically, instead of returning the value of 0 for drop_ssm, I could get the 'drop_ssm' instead.

Many thanks for any advice,

© Stack Overflow or respective owner

Related posts about c