variable - modifiable lvalue

Discussion in 'C Programming' started by v4vijayakumar, May 15, 2006.

  1. What is the difference between a variable and a modifiable lvalue?
    TIA.
    v4vijayakumar, May 15, 2006
    #1
    1. Advertising

  2. v4vijayakumar

    Guest

    v4vijayakumar wrote:
    > 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.

    --
    Paul Hsieh
    http://www.pobox.com/~qed/
    http://bstring.sf.net/
    , May 15, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Biber

    Re: Why is this not a modifiable lvalue.

    Simon Biber, Jun 27, 2003, in forum: C Programming
    Replies:
    0
    Views:
    2,351
    Simon Biber
    Jun 27, 2003
  2. Dan Pop

    Re: Why is this not a modifiable lvalue.

    Dan Pop, Jun 27, 2003, in forum: C Programming
    Replies:
    6
    Views:
    4,909
    Dan Pop
    Jun 30, 2003
  3. Martin Ambuhl

    Re: Why is this not a modifiable lvalue.

    Martin Ambuhl, Jun 27, 2003, in forum: C Programming
    Replies:
    0
    Views:
    701
    Martin Ambuhl
    Jun 27, 2003
  4. Micah Cowan

    Re: Why is this not a modifiable lvalue.

    Micah Cowan, Jun 28, 2003, in forum: C Programming
    Replies:
    1
    Views:
    760
    CBFalconer
    Jun 28, 2003
  5. Kavya

    lvalue -modifiable and non-modifiable

    Kavya, Nov 6, 2006, in forum: C Programming
    Replies:
    3
    Views:
    433
    Keith Thompson
    Nov 6, 2006
Loading...

Share This Page