call by pointer, call by address, Function in C++
Simple example of Function in C++, which explain the working of call by pointer/call by address:

Program Code:
#include <iostream>
using namespace std;
int  hello(int *x)
{
*x=*x+10;
cout<<*x;
return *x;
}
int main()
{
int x;
cin>>x;
cout<<x;
cout<<endl;
hello(&x);
cout<<endl;
cout<<x;
}

The output of the program is tested on www.jdoodle.com
Output:
10
20
20



Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: