Pointer References In C++
If we declare any type of variable then we have
to use address operator at that time
it is called variable reference.
If reference variable is integer type then
variable address can store, and reference variable memory allocation is in heap.
In normal variable memory allocation is in
static, its means reference variable use to copy, so that kind of variable is
known as pointer reference.
Fig:Pointer References In C++
Example:
int a;
a=30;
int &b=a;
Program:
#include<iostream.h>
#incldue<conio.h>
void
main()
{
int num;
int
&num1=num;
cout<<”input
a value”;
cin>>num;
cout<<”num=”<<num;
cout<<”num1=”<<num1;
getch();
}
Output:
input
a value 2
num=2,
num1=2
No comments:
Post a Comment