Alogarithm steps:
- Start the program
- Write the function and pass the address of one value through that function
- Assign the address to pointer
- Perform the multiplication operation
- Compile and execute the program.
CPP Program For Call By Reference
#include
#include
void multi(int &a)
{
int a,b,c;
int *q = &p;
cout<<”Enter the b value:”
cin>>b;
c=q*b;
cout<<”Multiplication of a and b is: “<>a;
muti(&a);
return 0;
}
SAMPLE INPUT AND OUTPUT:
a: 34
Enter the b value: 23
Multiplication of a & b is: 782
|