fork download
  1. #include <iostream>
  2.  
  3.  
  4. int f() {
  5. static int counter = 0;
  6. return counter++;
  7. }
  8.  
  9. void g(int e = f())
  10. {
  11. std::cout << e << std::endl;
  12. }
  13.  
  14. int main() {
  15. g(); // 0
  16. g(42); // 42
  17. g(); // 1
  18.  
  19. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
0
42
1