I have seen this link
How to convert enum names to string in c
I have a series of enums
defined in the following manner in client provided library header file (which I can't change):
Also the enums are sparse .
typedef enum
{
ERROR_NONE=59,
ERROR_A=65,
ERROR_B=67
}
I want to print these values in my function for instance I would like to print ERROR_NONE
instead of 59
. Is there a better way of just using switch
case
or if else
constructs to get this done ?
Example
int Status=0;
/* some processing in library where Status changes to 59 */
printf("Status = %d\n",Status); /* want to print ERROR_NONE instead of 59 */