I was playing around with the Bool type (Boolean Variable) and typed this:
#include <iostream>
int main(void)
{
using std::cout;
using std::cin;
using std::endl;
bool $ok = false & true;
if($ok == true)
{
cout << "The value is True." << endl;
}
else if($ok == false)
{
cout << "The value is false." << endl;
}
cin.get();
cin.get();
return 0;
}
I know the differences between using the bitwise operator & and the logical operator &&, but I do not see how this produces a false (0) value. I know if I swapped the bitwise operator and used a + the expression 0+1 would cause it to evaluate to true. Can someone explain why this:
bool $ok = false & true;
evaluates to false?