Advertisement
Sinux1

T6E1stackoverflow

Mar 15th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void mountainview()
  6. {
  7.     cout << "mountainview - it is where google is located" << endl << endl;
  8.  
  9.     mountainview(); // causes stack overflow
  10.                     // because functions call functions and functions
  11.                     //put on hold then crash at a limit
  12.  
  13.     cout << "mountainview - it is the end of this func " << endl << endl;
  14.  
  15.  
  16.  
  17. }
  18.  
  19. void cupertino()
  20. {
  21.  
  22.     cout << "cupertino - is where apple is!" << endl << endl;
  23.  
  24.     mountainview();
  25.  
  26.     cout << "cupertino - this is the end of cupertino func!" << endl << endl;
  27.  
  28.  
  29.  
  30. }
  31. int main()
  32. {
  33.     cout << "main - we are beginning the main function" << endl << endl;
  34.  
  35.     cupertino();
  36.  
  37.     cout << "main - ending the main function" << endl << endl;
  38.  
  39.  
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement