0
lvalue and rvalue reference
can anyone explain what do you mean rvalue reference and lvalue reference ? and explain this example. int && x = 4; int i = 5, j = 6; int && w = i + j; plz.
5 Antworten
+ 8
Man actually i used to get some error like:
Lvalue required.
Think it as a box containing an apple .. The apple is the rvalue and the box number is the lvalue ...
Here the apple is the number "5" and box is "a"
Man the above example was so helpful. Man are u making fun of me by all that forgiveness! I'm a beginner myself just learning some stuffs.
Dude Trust me, you just cleared my confusion.
+ 7
bhomic
Man you are a genius.
Did You mean to say:
int a = 5;
in this case a is Lvalue and 5 is RLvlue?
Did i understand it right man?
+ 6
Sick Line Bro🌡️
Well yea.. in the example ..
int a =5;
"5" is rvalue as it is going to reside in a memory location
Named as "a"
And hence .." a" is the lvalue as it refers to some address in the main memory serving as a location for the run time...
Think it as a box containing an apple .. The apple is the rvalue and the box number is the lvalue ...
Here the apple is the number "5" and box is "a"
plz forgive me if i m wrong as i m a beginner only ...
🙏🙏🙏
+ 5
Lvalue generally means the location value and the rvalue means the residing value.....
Lvalue is found on the left hand side of the assignment operator whereas the rvalue is found on the right hand side.. Of the assignment operator (=).
+ 5
Sick Line Bro🌡️ oh thank u man .... I m really happy if it were a bit helpful..