So, I\'ve got this definition:
typedef enum {
red = 1,
blue = 2,
white = 3
} car_colors;
Then, I\'ve got a variable of type car_col
There are a lot of great answers to this here: Converting between C enum and XML
They are basically the same as Abizern's, but are a little cleaner and easier to work with if your app does this string-to-enum conversion a lot. There are solutions which keep the string and enum definitions together, and ways to make the conversions each a single, easy-to-read line of code.