what's an lvalue? (was Re: Help with casts)
Jonathan I. Kamens
jik at athena.mit.edu
Fri Feb 22 14:43:22 AEST 1991
In article <1991Feb21.040145.8678 at cec1.wustl.edu>, abed at saturn.wustl.edu (Abed M. Hammoud) writes:
|> This is probably not a smart question...so please forgive me..
|> I am new to C, and I have been a couple of times encountering
|> the term lvalue...I looked it up in K&R C book but I still don't
|> get it...could some body please help me with a small description.
From pages 64-65 of the March 1988 edition of the dragon book ("Compilers,
principles, techniques, and tools," by Alfred V. Aho, Ravi Sethi, and Jeffrey
D. Ullman):
L-values and R-values
There is a distinction between the meaning of identifiers on the left and
right sides of an assignment. In each of the assignments
i := 5;
i := i + 1;
the right side specifies an integer value, while the left side specifies where
the value is to be stored. Similarly, if p and q are pointers to characters,
and
p^ :- q^;
the right side q^ specifies a character, while p^ specifies where the
character is to be stored. The terms l-value and r-value refer to values that
are appropriate on the left and right side of an assignment, respectively.
That is, r-values are what we usually think of as "values," while l-values are
locations.
--
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
More information about the Comp.lang.c
mailing list