fork download
  1. #include <iostream>
  2.  
  3. int main(){
  4. for(int i = 0; i < 10; ++i) {
  5. struct lambda {
  6. explicit lambda(int i) : i(i) {}
  7. int i;
  8. int operator()() { static int x = 0; x +=4; std::cout << i << " " << x << std::endl; return i; }
  9. };
  10. lambda a(i);
  11. a();
  12. }
  13. char foo[50];
  14. gets(foo);
  15. }
Success #stdin #stdout 0s 2832KB
stdin
Standard input is empty
stdout
0 4
1 8
2 12
3 16
4 20
5 24
6 28
7 32
8 36
9 40