fork(3) download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int b2i(bool v)
  6. {
  7. return v << 1;
  8. }
  9.  
  10. int main() {
  11. bool v = true;
  12. cout << "v = " << v << endl;
  13. cout << "b2i(v) = " << b2i(v) << endl;
  14. memset(&v, -1, sizeof v);
  15. cout << "b2i(v) = " << b2i(v) << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 2728KB
stdin
Standard input is empty
stdout
v = 1
b2i(v) = 2
b2i(v) = 510