Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.lang.c Subject: what's an lvalue? (was Re: Help with casts) Message-ID: <1991Feb22.034322.28542@athena.mit.edu> Date: 22 Feb 91 03:43:22 GMT References: <1991Feb21.040145.8678@cec1.wustl.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 36 In article <1991Feb21.040145.8678@cec1.wustl.edu>, abed@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710