Add a Function Prototype before main() function - C++ Function

C++ examples for Function:main function

Description

Add a Function Prototype before main() function

Demo Code

#include <iostream> 
#include <string> 
using namespace std; 

void printName(string first, string last); 

int main() //from w ww  .  j  a  v  a2s  .c  om
{ 
  printName("a", "b"); 
  return 0; 
} 

void printName(string first, string last) 
{ 
  string fullname = first + " " + last; 
  cout << fullname << endl; 
}

Result


Related Tutorials