So I've been updating one of my 3d games in c and I notice that when every I reference a bool variable that was declared in a header file I get a crash screen. If I initialize the variable to false, everything works fine but I am wondering if I am miss using the the header files or something.
My set up is like this;
common.h has this code;
#ifndef common_h
#define common_h
bool debug;
#endif
main.c has this code;
include common.h
bool *myboolv;
void store( bool *boolv ){
myboolv = boolv;
}
void check_value(){
if( *boolv == true) { /* crashes on this if statement */ }
}
void main(){
store(&debug);
check_value();
}common.c doesn't have anything in it. If I initialize debug in the main it works fine but other wise I not sure why I getting the error.