Call a function in main : main function « Language Basics « C++ Tutorial






#include <iostream>
 
 void DemonstrationFunction()
 {
     std::cout << "In Demonstration Function\n";
 }
 
 int main()
 {
     std::cout << "In main\n" ;
     DemonstrationFunction();
     std::cout << "Back in main\n";
     return 0;
 }
In main
In Demonstration Function
Back in main








1.2.main function
1.2.1.A C++ program begins at main()
1.2.2.Call a function in main