#include <iostream>
using namespace std;
void someFunction(bool& a);
int main()
{
bool a = true;
someFunction(a);
if( a )
cout <<"a = true";
else
cout <<"a = false";
}
void someFunction(bool& a)
{
a = false;
}
This will print out "a = false".
bool& a in the someFunction contains a memory address, no?
So how can you take a memory address = value?
Wouldn't that try to change the memory address into false in this case?