Results 1 to 7 of 7

Thread: What does lvalue and rvalue means in C?

  1. #1
    Join Date
    Dec 2009
    Posts
    17

    What does lvalue and rvalue means in C?

    I am a beginner programmer. Right now i am studying C language. I also know programming language like Java, SQL and Html. Currently i was programming in C language and got error: error in lvalue. I don't know this much about this error and want to overcome it. I have hear that there is lvalue and rvalue in C language, but what does that mean, i don't. Please anyone can help me on this.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: What does lvalue and rvalue means in C?

    The error you got i.e lvalue occurs because compiler would not get any addressable value in program. The lvalue is known as location and rvalue is known as read value. The lvalue is the address that is stored into, while rvalue is a constant or the value stored at the particular location. In the assignment: d = 42;
    we have the lvalue of a used on the left hand side and the integer constant value 31 assigned to this location.
    In the assignment: d = c;
    we have the rvalue of c (31) used to assign to the lvalue of d. This are two different type of behaviors of lvaue and rvalue.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: What does lvalue and rvalue means in C?

    The terms lvalue (pronounced "ELL-value") and rvalue (pronounced "AR-value"), and this very rarely heard as they occasionally comes in compiler error messages. Most of C language books does not explain lvalues and rvalues very well/clearly. So, most of people come up with this question only.Iif you program in C, then you can get by without understanding what lvalues and rvalues really means. But knowing the exact lvalues and rvalues provides makes valuable insights into the behavior of built-in operators and to execute those operators compilers generate the code of it. Hope you can fix the problem of yours.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: What does lvalue and rvalue means in C?

    According to me, lvalue you got is due to no addressable memory in your program.And Lvalue(lvalue) means location value, while Rvalue(rvalue) means read value. Assume the code is:
    int j;
    j=6;
    Here j is lvalue(location value) and 6 is rvalue(read value).And if write code something like 6=j; then it will generate error i.e lvalue is required. I also know this much about this lvalue and rvalue, as you would be also knowing that it very difficult to find theory on this. Hope this would clear your doubt.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: What does lvalue and rvalue means in C?

    My studies in C language says that expressions which refer to the memory locations are called 'l-value' expressions( also known location value). An lvalue denotes a storage regions 'locator' value, or a 'left' value, implies that it can appear on the left of the equal sign(=). The lvalues are usually identifiers. The term 'r-value' may be used to denote the value of an expression and to distinguish/differ it from an lvalue. All l-values are r-values but not all r-values are l-values.

  6. #6
    Join Date
    May 2008
    Posts
    2,297

    Re: What does lvalue and rvalue means in C?

    I would say that lvalue(location) is an expression which will exist on the left side of the equal to operator( i.e =). And an r-value is an expression which will exist on the right side. Also we can say that set of rvalue's is a subset of the set of lvalue's( note: lvalue's are not subset on any rvalue's). And the error you got lvalue error is due to no addressable memory in your program. Hope you will to fix the problem.

  7. #7
    softtrick Guest

    Re: What does lvalue and rvalue means in C?

    Expressions that refer to memory locations are called "l-value" expressions. An l-value represents a storage region's "locator" value, or a "left" value, implying that it can appear on the left of the equal sign (=). L-values are often identifiers.

    More detail Visit Below Link:

    http://msdn.microsoft.com/en-us/library/bkbs2cds.aspx

Similar Threads

  1. What does multi monitor kvm means
    By Toraidio in forum Windows Software
    Replies: 5
    Last Post: 16-02-2010, 02:44 PM
  2. What does at @ identifier means in C#
    By Shaan12 in forum Software Development
    Replies: 3
    Last Post: 17-11-2009, 01:29 AM
  3. What does a HDTV means
    By xanix in forum Monitor & Video Cards
    Replies: 3
    Last Post: 29-07-2009, 04:22 PM
  4. What is prefetch? What does it means
    By AMISH in forum Operating Systems
    Replies: 3
    Last Post: 27-07-2009, 09:21 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,729,041.35189 seconds with 16 queries