Accessing a variable in several functions in several files
I am in the process of seperating my project into multiple files. I have a variable(my only truely global variable) that needs to be set in a dialog box(yes this is a windows app but its a C question) which I can do and then it needs to be read by the AI in a seperate file. I tried declaring it in a header file they both accessed but then they both accessed it but it seemed like the AI was getting a calue that wasn't what was selected in the Diallog(It was coming up like it was never initilized). Then I tried a hackish message of have the Dialog return the value I selected and then passed that to the AI function as a parameter but that led to it always be 1. Im sure Im not the first with this problem but I can't think off anyway to have it work which I haven't tried. So how can I acess a variable in multiple files?