HPlogo HP C/HP-UX Reference Manual: Workstations and Servers > Chapter 5 Expressions

Lvalue Expressions

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

An lvalue (pronounced "el-value") is an expression that designates an object. A modifiable lvalue is an lvalue that does not have an array or an incomplete type and that does not have a "const"-qualified type.

The term "lvalue" originates from the assignment expression E1=E2, where the left operand E1 must be a modifiable lvalue. It can be thought of as representing an object "locator value." For example, if E is the name of an object of static or automatic storage duration, it is an lvalue. Similarly, if E denotes a pointer expression, *E is an lvalue, designating the object to which E points.

Examples

Given the following declarations:

int *p, a, b;
int arr[4];
int func();

a /* Lvalue */
a + b /* Not an lvalue */
p /* Lvalue */
*p /* Lvalue */
arr /* Lvalue, but not modifiable */
*(arr + a) /* Lvalue */
arr[a] /* Lvalue, equivalent to *(arr+a) */
func /* Not an lvalue */
func() /* Not an lvalue */