INCR statement

Purpose

Increment a variable by 1; increment a pointer by the size of its target; or increment the target of a numeric pointer by 1.

Syntax

INCR variable

Remarks

variable can be a numeric or a pointer variable.  When INCR is used with a numeric variable, 1 is added to the numeric variable.

When INCR is used with a pointer variable itself, the value of the pointer is incremented by the size of the pointer's target.

When INCR is used on a numeric pointer's target (i.e., INCR @IntPtr) the value of the target is incremented by 1.

For example, given a pointer to an array where the pointer targets element 1000, applying INCR to the pointer would result in the pointer aiming at element 1001.  The actual address held by the pointer would have risen by two, because the target of the pointer is an Integer which is two bytes wide.

Conversely, if INCR was used on the target of this Integer pointer, the value of the element itself would be incremented by 1.

See also

DECR

Example

DIM x&, LongPtr AS LONG POINTER

INCR x&

INCR LongPtr

INCR @LongPtr