I have two cpp files, and I want one of them to be able to tell me the value of some specific variables declared in the other C++ file. For example:
file1.cpp
int var1 = 10;
while (true) {std::cin >> var1;}
I want another cpp file, file2.cpp, when compiled, to be able to tell me the value of file1->var1.
Now, I realise that I can use files to store the value and read it but that seems like it's not the "right" way to do it, so what would the right way be (maybe storing it in a specific spot in RAM?)
Edit: Since some people asked, both the cpp files are going to be compiled separately. They are going to be independent executables.