Home >Backend Development >C++ >lvalue and rvalue in C language

lvalue and rvalue in C language

WBOY
WBOYforward
2023-08-29 09:57:02765browse

lvalue and rvalue in C language

An lvalue (locator value) represents an object that occupies an identifiable location (that is, has an address) in memory.

Rvalues ​​are defined by exclusion. Every expression is either an lvalue or an rvalue, so an rvalue is an expression that does not represent an object occupying some identifiable location in memory.

For example, assignment expects an lvalue as its left operand, so the following is valid:

int i = 10;
But this is not:
int i;
10 = i;

This is because i has an address in memory and is an lvalue . And 10 has no recognized memory location and is therefore an rvalue. So assigning a value of 10 for i makes no sense.

The above is the detailed content of lvalue and rvalue in C language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete