Pointer hold an address and use that address to modify
the original value.To access a variable through a pointer we
derefer it.
Pointer is an Alias for another variable.So if we
pass a pointer into a function,we are actually passing
an alias to the outside object.
{
int a=2;
int &b=a;
b=24;
cout<<a>>endl;
}
output will be 24 as b refer to a.
the original value.To access a variable through a pointer we
derefer it.
Pointer is an Alias for another variable.So if we
pass a pointer into a function,we are actually passing
an alias to the outside object.
{
int a=2;
int &b=a;
b=24;
cout<<a>>endl;
}
output will be 24 as b refer to a.
No comments:
Post a Comment