I have a VC++ solution (using VS2008) with 2 projects Project A & project B.
Everything I discuss below is wrt Project A.
Project A has a sourec file a.cpp & it includes a header file "a.h". "a.h" has a variable int varA; which is modifies inside a.cpp.
a.cpp: int varA = x*2; // also do some calculations with varA in a.cpp Now there is one more sourec file b.cpp in the same project A. And now lets say this "b.cpp" also includes same header file "a.h". i.e
b.cpp int varB = varA; // If I want to access varA & get the current value of varA here in b.cpp what should do ? Will it work if I declare varA as extern in a.h & include Here it's important to note that I wnat to not only access the variable varA from within b.cpp but also want to access the current value of this variable as updated by a.cpp.
Thnaks in advance.
varAinb.cppafter it has been modified ina.cpp?