.TH lvalue "" "" Definition
.PC
.PP
An
.B lvalue
is an expression that designates a region of storage.
The name comes from the assignment expression
.BR "e1=e2;" ,
in which the left operand must be an lvalue.
.PP
An identifier has both an
.I lvalue
(its address) and an
.I 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
.I e
is a pointer expression,
.I *e
is an lvalue that designates the object to which
.I e
points.
.PP
A \fIvariable\fR can be used as an lvalue, whereas
a constant cannot.
For example, you cannot say
.DM
	6 = (foo+bar);
.DE
.PP
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
.DM
	int foo[10];
	int *bar;
	foo = bar;
.DE
.PP
will generate an error message when you attempt to compile it, whereas
.DM
	int foo[10];
	int *bar;
	bar = foo;
.DE
.PP
will not.
.PP
The following example shows the use of both an lvalue and a rvalue:
.DM
.ta 1.1i
int i, *ip;
.sp \n(pDu
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 */
.DE
.SH "See Also"
.Xr "Programming COHERENT," programmi
.Xr "rvalue" rvalue
.br
\*(AS, \(sc6.2.2.1
