By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,514 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,514 IT Pros & Developers. It's quick & easy.

lvalue?

P: n/a
Sometimes we get an error of lvalue requred?What exactly is the lvalue?
And when this error occures?

May 27 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <11**********************@n15g2000prd.googlegroups .com>,
Shraddha <sh*************@gmail.comwrote:
>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
May 27 '07 #2

P: n/a
Shraddha <sh*************@gmail.comwrites:
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
May 27 '07 #3

P: n/a
Ben Pfaff wrote:
Shraddha <sh*************@gmail.comwrites:
>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.

May 27 '07 #4

P: n/a
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>

May 27 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.