COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button
C++ LANGUAGE LVALUES AND RVALUES
Lvalues and Rvalues
There are two kinds of expressions in C++:
• lvalue : Expressions that refer to a memory location is called
"lvalue" expression. An lvalue may appear as either the left-hand or
right-hand side of an assignment.
• rvalue : The term rvalue refers to a data value that is stored at
some address in memory. An rvalue is an expression that cannot have
a value assigned to it which means an rvalue may appear on the right-
but not left-hand side of an assignment.
Variables are lvalues and so may appear on the left-hand side of an
assignment. Numeric literals are rvalues and so may not be assigned
and cannot appear on the left-hand side. Following is a valid statement:
int g = 20;
But the following is not a valid statement and would generate compile-time error:
10 = 20;
No comments:
Post a Comment