|
|
 |
 |
 |
 |
lvalue?
Sometimes we get an error of lvalue requred?What exactly is the lvalue? And when this error occures?
In article <1180240791.243647.230@n15g2000prd.googlegroups.com>, Shraddha <shraddhajosh @gmail.com> wrote: >Sometimes we get an error of lvalue requred?What exactly is the lvalue? >And when this error occures? What did you come up with when you googled for lvalue ? -- There are some ideas so wrong that only a very intelligent person could believe in them. -- George Orwell
Shraddha <shraddhajosh @gmail.com> writes: > Sometimes we get an error of lvalue requred?What exactly is the lvalue? Informally speaking, an lvalue is an expression that can appear on the left side of an assignment operator. Generally, an lvalue is an expression that designates an object (a region of memory): a variable, a dereferenced pointer, etc. In fact in C the definition of an lvalue is different from what this informal idea would suggest, but this is a reasonable place to start thinking about them. -- Comp-sci PhD expected before end of 2007 Seeking industrial or academic position *outside California* in 2008
Ben Pfaff wrote: > Shraddha <shraddhajosh @gmail.com> writes: >> Sometimes we get an error of lvalue requred?What exactly is the lvalue? > Informally speaking, an lvalue is an expression that can appear > on the left side of an assignment operator. Generally, an lvalue > is an expression that designates an object (a region of memory): > a variable, a dereferenced pointer, etc. In fact in C the > definition of an lvalue is different from what this informal idea > would suggest, but this is a reasonable place to start thinking > about them.
And there's plenty of stuff in the archives on this topic, some of it more off-topic (but historically interesting) than others. [You get an "lvalue required" message when you are supposed to have an lvalue but you didn't supply one; a typical example would be assigning to an array or something++.] -- Double Plus Good Hedgehog The "good old days" used to be much better.
Shraddha wrote: > Sometimes we get an error of lvalue requred?What exactly is the lvalue? > And when this error occures?
This is a FAQ, check Question 20.39b. Let say i is a int, then consider the assignment i = i + 1; here the r.h.s "i" is an int value, while the identifier "i" on the l.h.s. refers to something very different, namely a memory location. Hence, l-value is the value of "i" on the l.h.s of the assignment, while r-value refer to the value of the identifier on the r.h.s. -- Tor <torust [at] online [dot] no>
|
 |
 |
 |
 |
|