variable - modifiable lvalue

W

websnarf

v4vijayakumar said:
What is the difference between a variable and a modifiable lvalue?

A variable is independent named storage. An lvalue is basically just
storage that can appear on the left side of an assignment. So in these
cases:

x.y = 3; /* struct { int y; } x; */
q = "Hello"; /* char * q[]; */
*(p + 3) = 7; /* int * p; */
*(f(3)) = 2; /* int * f(int); */

x.y, q, *(p+3) and *(f(3)) are all lvalues, but none are variables.
However, x, q and p are variables. f is a function, so there is no
variable at all involved there, nevertheless an assignment to an lvalue
does happen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

lvalue -modifiable and non-modifiable 3
lvalue? 4
Lvalue? 10
lvalue and rvalue? 14
Lvalue 16
Lvalue Required(wierd)... 20
Why is Python telling me variable is local not global? 3
receiving lvalue as rvalue 3

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top