how to declare an external variable of type "enum"?
If I have a global integer x, which I declare in main.c and want to use in function.c, I am able to do so by stating the following in header.h:
However, what do I do if I have a global enum? In my main.c I declare a global variable as follows:
Code:
enum whoseturn {B, W};
enum whoseturn color=W;
But how do I declare it in my header in order to use it in function.c? I have tried such things as
Code:
extern enum whoseturn color;
extern whoseturn color;
extern enum color;
But I consistently get error messages when I try to set color to B or W, to the effect B and W have not been declared. How do I do this globally?