Program to show three functions which is used to triplicate the value of num defined in main. One function accepts the parameter with call by value , second through call by reference and third by call by address in C++
#include
#include
#include
int value(int);
int adress(int*);
int reference(int&);
void main()
{
int a;
clrscr();
cout<<"Enter any number ";
cin>>a;
cout<<"triplicate value using call by value = "<
cout<<"triplicate value using call by adress = "<
cout<<"triplicate value using call by reference = "<
getch();
}
int value(int a)
{
return(a*a*a);
}
int adress(int *a)
{
return((*a)*(*a)*(*a));
}
int reference(int &a)
{
return(a*a*a);
}
No comments:
Post a Comment