COHERENT manpages

This page displays the COHERENT manpage for lvalue [Definition].

List of available manpages
Index


lvalue -- Definition

An lvalue is  an expression that designates a region  of storage.  The name
comes from the assignment expression e1=e2;, in which the left operand must
be an lvalue.

An  identifier  has  both  an  lvalue  (its address)  and  an  rvalue  (its
contents).  Some C operators require lvalue operands; for example, the left
operand of an assignment statement  must be an lvalue.  Some operators give
lvalue results; for example, if e  is a pointer expression, *e is an lvalue
that designates the object to which e points.

A  variable can  be used  as  an lvalue,  whereas a  constant cannot.   For
example, you cannot say

    6 = (foo+bar);

A pointer  is a variable, and  can be manipulated within  limits.  An array
name, however, is a constant and cannot be altered legally.  Thus, the code

    int foo[10];
    int *bar;
    foo = bar;

will generate an error message when you attempt to compile it, whereas

    int foo[10];
    int *bar;
    bar = foo;

will not.

The following example shows the use of both an lvalue and a rvalue:

int i, *ip;

ip = &i;/* ip is an lvalue, i and &i are rvalues */
i = 3;     /* i is an lvalue, 3 is an rvalue */
*ip = 4;   /* *ip is an lvalue, 4 is an rvalue */

See Also

Programming COHERENT,
rvalue
ANSI Standard, §6.2.2.1