fork download
  1. #include <iostream>
  2. #include <functional>
  3. //#include <future>
  4.  
  5. void func(std::function<void()> a) {
  6. a();
  7. }
  8.  
  9. int main() {
  10. int x = 2;
  11. int *f;
  12. auto p = [&] { x = 4; f = (int *)alloca(sizeof(int)*400); f[200] = 4; };
  13. //p();
  14. func(p);
  15. std::cout << f[199] << " " << f[200];
  16. }
  17.  
Success #stdin #stdout 0s 2960KB
stdin
Standard input is empty
stdout
-1215490541 4