In my code, due to efficiency consideration, I place a long function in it's own file (let's name it a.cpp). I have also created a second file named b.cpp which holds another function which uses the same variables names.
I have tried to create a header file for those variables but it didn't work. Is there a way to do that (apart from placing the functions in the same file)?
A simple example:
a.cpp
double s;
void a(){
s = 1.0;
printf("%f\n",s);
}
b.cpp
double s;
void b(){
s = 2.0;
printf("%f\n",s);
}
Note Each of those file is, in effect a c but the whole program is c++.