2

I have such enum constuct and 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;
}

Then I want to print the value of f.type:

printf("%s", str(f->type));

But as output I have, when I expected to have "MCSIMULATION":

f->type

How to print it properly?

Kenenbek Arzymatov
  • 8,439
  • 19
  • 58
  • 109

0 Answers0