我有enum constuct
和typedef struct
:
#define str(x) #x
typedef enum {
MCSIMULATION,
} jobType;
typedef struct {
jobType type;
}x, *xPtr;
int main(){
xPtr f = malloc(sizeof(x));
f->type = MCSIMULATION;
return 0;
}
然后我要打印f.type
:
printf("%s", str(f->type));
但是作为我的输出,当我期望有" MCSIMULATION":
f->type
如何正确打印?