Export (0) Print
Expand All

A.5.5 Pointer increment and decrement

Visual Studio .NET 2003

In an unsafe context, the ++ (Section 7.5.9) and -- operators (Section 7.6.5) can be applied to pointer variables of all types except void*. Thus, for every pointer type T*, the following operators are implicitly defined:

T* operator ++(T* x);
T* operator --(T* x);

The operators produce the same results as x + 1 and x - 1, respectively (Section A.5.6). In other words, for a pointer variable of type T*, the ++ operator adds sizeof(T) to the address contained in the variable, and the -- operator subtracts sizeof(T) from the address contained in the variable.

If a pointer increment or decrement operation overflows the domain of the pointer type, the result is implementation-defined, but no exceptions are produced.

Show:
© 2015 Microsoft