fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Block {
  5. int number;
  6. };
  7.  
  8. int main() {
  9.  
  10. Block block;
  11. block.number = 1;
  12.  
  13. auto closure = [&block]{ cout << "n: " << block.number << endl; };
  14.  
  15. closure();
  16.  
  17. cout << "n: " << block.number << endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
n: 1
n: 1