KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Here's what I am trying to do: typedef enum { ONE, TWO, THREE } Numbers; I am trying to write a function that would do a switch case similar to the following: char num_str[10]; int process_numbers_str(Numbers num) { switch(num) { case ONE: case TWO: case THREE: { strcpy(num_str, num); //some way to get the symbolic constant name in here? } break; default: return 0; //no match return 1; } Instead of defining at every case, is there a way to set it using the enum variable like I am trying to do above?
Tags (comma-separated)
Save Edits
Cancel