7 years, 7 months ago.

Why struct fails?

Why this code fails while it is correct?

struct token_exchanger{ char *token; int value;};

communications static const struct token_exchanger instruction_set[]= {{"put",TOKEN_PUT},{"get",TOKEN_GET} };

First: When I write the first like like this :

struct token_exchanger{ char *token; int value; };

It fails, ..

SECOND: Ok I make it like this

struct token_exchanger{ char *token; int value;};

Compile is happy now .. but the second line fails now

static const struct token_exchanger instruction_set[]= {{"put",TOKEN_PUT},{"get",TOKEN_GET} };

I don't think I made a mistake .. but still the compiler is not happy .. Very strange

Be the first to answer this question.