Home » C programming language

What do 'lvalue' and 'rvalue' mean in C/C++?



'lvalue' and 'rvalue' in C/C++ programming language: Learn, in an expression what do 'lvalue' and 'rvalue' mean?

Consider the following expression:

result=(a+b);

An "lvalue" is an expression, variable, constant etc which appears at left-hand side of an assignment operator.

In the expression result =(a+b); - result is an "lvalue".

An "rvalue" is an expression, variable, constant etc which appears at right- hand side of an alignment operator.

In the expression result =(a+b); - (a+b) is an "rvalue";

Consider the following expression, which is also a valid "lvalue" assignment.

((a+b)? a:b) =10;

In the expression, either a or b will be the result of "lvalue" expression and 10 can be assigned in a or b. so this expression is also a valid expression.






Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.



Comments and Discussions


We are using Google to publish ads on our website; Google has its own privacy policies. They may save log, cookies on your system. Google may also collect information of your system like IP address, region, city, country. For more details please go through the Google’s privacy policy.