C++ examples for Function:Function Parameter
Get a name in an array, then print it using separate functions.
#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; }