Advertisement
karlicoss

segfault

Apr 12th, 2012
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1.  
  2. #include <vector>
  3.  
  4. struct Foo
  5. {
  6.     double a, b, c, d;
  7. };
  8.  
  9. std::vector<Foo> nodes;
  10. int left = 3;
  11.  
  12.  
  13. double run()
  14. {
  15.     if (left == 0)
  16.         return 1.0;
  17.    
  18.     left--;
  19.     nodes.push_back(Foo());
  20.  
  21.     nodes[0].a = run();
  22.  
  23.     //double tmp = run();
  24.     //nodes[0].a = tmp;
  25.  
  26.     return 1.0;
  27. }
  28.  
  29. int main()
  30. {
  31.     run();
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement