BM Balmiki Mandal 28 Dec 2022 5 views 0 comments C Programming

What is an lvalue?

Understanding lvalues and rvalues in C programming

In programming, an lvalue (locator value) is an expression that denotes an object that has an identifiable location in memory. Lvalues can be used on the left-hand side of an assignment operator, which means that they can be assigned a value.

Some examples of lvalues in C and C++ are:

  • Variable names
  • Array elements
  • Pointers to objects
  • Function calls that return lvalue references

The following are not lvalues:

  • Constants
  • Expressions that evaluate to a function call
  • Expressions that evaluate to a temporary object

The term lvalue comes from the fact that lvalues can be used to "locate" an object in memory. For example, the expression int i = 10; defines the variable i as an lvalue, because it can be used to locate the object i in memory.

Lvalues are an important concept in programming, because they allow us to manipulate the values of objects in memory. For example, the following code assigns the value 10 to the variable i:

C Programming
int i = 10;

The i on the left-hand side of the assignment operator is an lvalue, because it denotes the object i in memory. The 10 on the right-hand side of the assignment operator is an rvalue, because it is a literal value that does not have an identifiable location in memory.

 

0 Comments

No comments yet, Be the first to comment.

Post a Comment

Please sign in to post a comment.

Related Posts

Bit wise operators Assignment

Bitwise Operators practical assignment: Take runtime input, bit-level manipulation, and different data units r...

AG Anvesh G 27 Sep 2026
Understanding Float and Double Binary Representation in C

Understanding Float and Double Binary Representation in CIntroduction:When we store decimal numbers such as 10...

AG Anvesh G 31 May 2026
Topic-wise C Programming Interview Questions

C Programming Interview Questions – Topic Wise1. IntroductionC programming is one of the most important langu...

AG Anvesh G 30 May 2026