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