Hey all, I found some strange behaviour that I don't understand.
The following code works in the main.c file. However it crashes when placed in a header file at line: "} CPlayer;". Can someone explain why? Am I missing something?
typedef struct CPlayerStruct {
char* someString;
int someInt;
void someFunction(struct CPlayerStruct* p);
} CPlayer;
I tried various combinations, but all crash with a compiler error.
typedef struct CPlayer {
char* someString;
int someInt;
void someFunction(struct CPlayer* p); // CRASH
} CPlayer;
struct CPlayerStruct {
char* someString;
int someInt;
void someFunction(struct CPlayerStruct* p);
}
typedef struct CPlayerStruct CPlayer; // CRASH
Thanks