fork download
  1. #include <iostream>
  2.  
  3. int foo() { static int instance; return ++instance; }
  4.  
  5.  
  6. void bar(int a = foo())
  7. {
  8. std::cout << a << std::endl;
  9. }
  10.  
  11.  
  12. int main() {
  13. for (int i = 0; i != 10; ++i) {
  14. bar();
  15. }
  16. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
1
2
3
4
5
6
7
8
9
10