C++ examples for Function:Function Creation
To see a local variable at work, consider the code in the following example:
#include <iostream> #include <string> using namespace std; void printName(string first, string last) { string fullname = first + " " + last; cout << fullname << endl; } int main() // www . j a va 2s . c o m { printName("a", "b"); return 0; }