Default Value Function In C++
Default Value Function In C++
Default Value Function - Function which parameters have some default value.
#include <iostream>
using namespace std;
void locality(int age = 18) // Passing A Default Value Of age
{
cout<<"Your Age Is: "<<age<<endl;
}
int main()
{
locality(); //Calling Without Passing Argument
locality(23); //Calling By Passing Argument
return 0;
}
Output -
Your Age Is: 18
Your Age Is: 23
Comments
Post a Comment