Get a name in an array, then print it using separate functions. - C++ Function

C++ examples for Function:Function Parameter

Description

Get a name in an array, then print it using separate functions.

Demo Code

#include <iostream>
using namespace std;
int get_name(char name[25]);
int print_name(char name[25]);
int main()/*ww w .  j  a va2s  .  c  o m*/
{
   char name[25];
   get_name(name);      
   print_name(name);    
   return 0;
}
int get_name(char name[25]) 
{
   cout << "What is your first name? ";
   cin >> name;
   return 0;
}
int print_name(char name[25])
{
   cout << "\n\n Here you are, " << name;
   return 0;
}

Result


Related Tutorials