Thread: lvalue

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    70

    lvalue

    hey what does the l-value mean in the expression
    left operand must be l-value mean?

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    l-value means left hand side of an = or comperason. Of course we could give you more help if we could see the code that wasy giving you the error.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    127
    The error is talking about a modifiable lvalue. A modifiable lvalue is an lvalue that isn't an array, const qualified type, incomplete type, or structure/union with any const qualified member. Most likely you're trying to assign an array to another array. Because arrays are not modifiable lvalues, you need to copy each element individually either with a loop, or with memcpy.
    Code:
    #include <string.h>
    
    [...]
    
    memcpy(array1, array2, n * sizeof *array1);

  4. #4
    Registered User
    Join Date
    May 2004
    Posts
    70
    thanks dudes

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. lvalue rvalue discussion
    By George2 in forum C++ Programming
    Replies: 18
    Last Post: 03-04-2008, 05:48 AM
  2. A non-const reference may only be bound to an lvalue?
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 12-14-2007, 06:42 PM
  3. how to use reference for lvalue
    By jabka in forum C++ Programming
    Replies: 9
    Last Post: 04-22-2007, 02:08 PM
  4. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 04:33 PM
  5. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM