I would like to send a value of a Boolean from file B.cc to A.cc, where A.cc is executed before B.cc for the next cycle of operation. I have the boolean value as an extern volatile and as a global variable. How do I save the value till the next cycle of operations.
A.cc
#include "linker.h"
#include "a.h"
bool right;
void a()
{
std::cout << right << std::endl;
}
B.cc
#include "linker.h"
#include "B.h"
bool right;
void B()
{
if(a%2 == 0)
{
right = false;
}
else right = true;
}
B.h
#ifdef _B_
#define _B_
int a
#endif
Linker.h
#ifdef _linker_
#define _linker_
extern volatile right;
#endif