Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) operator|

 

operator| (pronounces as 'bitwise or operator') is an operator to perform bitwise or operations. The example below shows how to reconstruct a truth table:

 

#include <iostream>

int main()
{
  const bool f = false;
  const bool t = true;

  std::cout
    << (f | f) << '\n'  //0
    << (f | t) << '\n'  //1
    << (t | f) << '\n'  //1
    << (t | t) << '\n'; //1
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict