fork download
  1. #include <iostream>
  2. int main()
  3. {
  4. const char *foo = "abc";
  5. const char *bar = "xyz";
  6.  
  7. bool b = false;
  8. const char* result1 = b ? foo : bar;
  9. const char* result2 = !b ? bar : foo;
  10.  
  11. std::cout << "result1: " << result1 << "\nresult2: " << result2 << '\n';
  12. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
result1: xyz
result2: xyz