What is ‘Reference Operator’ ?

No comments

Decides  the  normal  declaration  of  variable,  C++  allows  ‘reference’  to  be  declared  as  synonym  for  variable.  A  reference  to  a  variable  is  like  can  allise,  the  variable  name  and  the  reference  name  can  be  used  in  statement  which  effect  the  variable.

Example  :-       int  abc;

Int  &  ref  =  abc;

              In  the  above  example  a  variable  abc  is  define  subsequently  a  reference  ref   is  define,  which  due  to  initialization  addresses  in  same  memory  location,  which  abc  occupies.  In  the  definition  of  ref  , the  reference  operator  ‘&’  indicate  that  ref   is  not  itself  and  integer  but  a  reference  to  one.

The  two  statement  :-

abc ++

ref ++  have  same  effect

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀