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
  • 7,359
  • 16
  • 49
  • 97

0 Answers0