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

lvalue and rvalue in C language

WBOY
Release: 2023-08-29 18:39:38
forward
766 people have browsed it

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;
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template