Write the function and pass one value through that function
Call that function in the main program
Pass the value when we call that function
Compile and run the program
CPP Program For Call By Value
#include
void doubleIt(int);
int main ()
{
int num;
cout << "Enter number: ";
cin >> num;
doubleIt(num);
cout << "The number doubled in main is " << num << endl;
return 0;
}
void doubleIt (int x)
{
cout << "The number to be doubled is " << x << endl;
x *= 2;
cout << "The number doubled in doubleIt is " << x << endl;
}