Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 61

Advertising
background image

Lvalues

An lvalue is an object locator: an expression that designates an object. An example
of an lvalue expression is

*P

, where

P

is any expression evaluating to a non-null

pointer. A modifiable lvalue is an identifier or expression that relates to an object
that can be accessed and legally changed in memory. A const pointer to a constant,
for example, is not a modifiable lvalue. A pointer to a constant can be changed
(but its dereferenced value cannot).

Historically, the l stood for “left”, meaning that an lvalue could legally stand on
the left (the receiving end) of an assignment statement. Now only modifiable lval-
ues can legally stand to the left of an assignment operator. For example, if a and b
are nonconstant integer identifiers with properly allocated memory storage, they
are both modifiable lvalues, and assignments such as

a = 1

and

b = a + b

are

legal.

Rvalues

The expression

a + b

is not an lvalue:

a + b = a

is illegal because the expres-

sion on the left is not related to an object. Such expressions are sometimes called
rvalues (short for right values).

MikroElektronika: Development tools - Books - Compilers

53

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Advertising
This manual is related to the following products: