C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

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.









COMMENTS