HP 3000 Manuals

Prefix Increment and Decrement Operators [ HP C/iX Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Reference Manual

Prefix Increment and Decrement Operators 

The prefix increment or decrement operator increments or decrements its
operand before using its value.

Syntax 

     ++ unary-expression 
     -- unary-expression 

Description 

The operand for the prefix increment ++ or the prefix decrement --
operator must be a modifiable lvalue with scalar type.  The result is not
an lvalue.

The operand of the prefix increment operator is incremented by 1.  The
resulting value is the result of the unary-expression.

The prefix decrement operator behaves the same way as the prefix
increment operator except that a value of one is subtracted from the
operand.

For any expression E, the unary expressions ++E and (E+=1) yield the same
result.  If the value of X is 2, after the expression A=++X is evaluated,
A is 3 and X is 3.

Pointers are assumed to point into arrays.  Incrementing (or
decrementing) a pointer causes the pointer to point to the next (or
previous) element.  This means, for example, that incrementing a pointer
to a structure causes the pointer to point to the next structure, not the
next byte within the structure.  (Refer also to "Additive Operators" for
information on adding to pointers.)



MPE/iX 5.0 Documentation