Types of Variables

int x=5;

int *p;


https://abhisharmaofficial.blogspot.com/
P = &y; // address of operator
int &y = x;


This means the reference (address) of x variable will be store in y variable.


int &y = x;

https://abhisharmaofficial.blogspot.com/


Note: The reference variable must be initialized at the time of Declaration.   

Now at this time x and y are same.
e.g x=2 and y=2 are same

https://abhisharmaofficial.blogspot.com/

  §  Reference means Address.


  §  Reference variable is an internal pointer.

  §  Declaration of Reference Variable is preceded with ‘&’ Symbol (but do not read it as ‘address of’).

  §  Reference Variable must be initialized during the declaration.

  §  It can be initialized with already declared variables only.

  §  Reference variable cannot be update but pointer can be update.

        e.g

https://abhisharmaofficial.blogspot.com/

Here the address of variable a will be increased but not be value.

But Reference variable will increase the value of that variable but not the address. 

**You reached end of lecture**