Advertisement
Guest User

Passing value from one function to another

a guest
Dec 2nd, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. // http://stackoverflow.com/questions/13670796/passing-value-from-one-function-to-another
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. void fnMainMenu();
  8.  
  9. void fnLogin()
  10. {
  11.   std::string s = "hello";
  12.   fnMainMenu(s); // call Main Menu and I want to pass "hello"
  13.  
  14. }
  15.  
  16. void fnMainMenu(const std::string& msg)
  17. {
  18.   std::cout << msg << "\n";
  19. }
  20.  
  21. int main()
  22. {  
  23.  
  24.     fnLogin();
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement