The least-clever approach is to allocate some string constants that line up with the enumeration and index into it using the enumeration:
#include <stdio.h>
typedef enum {
WIFI_START,
WIFI_DIS,
WIFI_CON
} STATUS;
const char *status[] = {"WIFI_START", "WIFI_DIS", "WIFI_CON"};
void eventHandler(int event_id) {
printf("%s is triggered", status[event_id]);
}
int main() {
eventHandler(WIFI_DIS);
return 0;
}
I prefer this over a macro because, debugging/development utilities aside, program logic should be decoupled from the names used by the program to represent data. In other words, the program shouldn't behave differently based on variable name characteristics; it should be possible to minify, obfuscate or refactor the source code and be guaranteed you'll still get the same output.