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.

20th Apr 2017, 6:49 AM
‏‪‏‪عبدالله بوستة‬‏
‏‪‏‪عبدالله بوستة‬‏ - avatar
5 Respuestas
+ 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.
27th Apr 2019, 1:12 PM
Sick L̲̅i̲̅n̲̅e̲̅🌡️[TheBraveCoders]
Sick L̲̅i̲̅n̲̅e̲̅🌡️[TheBraveCoders] - avatar
+ 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?
27th Apr 2019, 10:55 AM
Sick L̲̅i̲̅n̲̅e̲̅🌡️[TheBraveCoders]
Sick L̲̅i̲̅n̲̅e̲̅🌡️[TheBraveCoders] - avatar
+ 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 ... 🙏🙏🙏
27th Apr 2019, 11:12 AM
Doggy
Doggy - avatar
+ 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 (=).
27th Apr 2019, 10:40 AM
Doggy
Doggy - avatar
+ 5
Sick Line Bro🌡️ oh thank u man .... I m really happy if it were a bit helpful..
27th Apr 2019, 1:29 PM
Doggy
Doggy - avatar