You can use the stringify macro operator #
.
#define STATE_OK (0)
#define STRINGIFY_2(s) STRINGIFY(s)
#define STRINGIFY(s) #s
#define DISPLAY_STATE_OK "StateOK=" STRINGIFY_2(STATE_OK)
But this only works if you #define
the values instead of using an enum
.