Because the address is passed by value, if you change the value of that address
within the function, you are actually changing a temporary copy. Consequently,
the original pointer address will not be changed!
Example:
#include "iostream"
#include "conio.h"
using namespace std;
void fun_test(int *);
int main()
{
int value=50;
int *ptr = &value; // Which means *ptr = 50
cout <
fun_test(ptr);
cout <
getch();
return 0;
}
void fun_test(int *arg_ptr)
{
int fun_value=10;
arg_ptr = &fun_value; // This will print 10
cout <
}
Question :
We are pass argument by address and if it is pass as value
then why the change in its value is affected at the original
calling place?
Answer :
When you change the value at the address
then it will affect to the original memory address's
content so its effect will still remains at the place
from where the function calls and argument's
address will be change by function statement.

