[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 9.115 Inc

### Synopsis

For ordinal types:

    procedure Inc (var x: ordinal type);

or

    procedure Inc (var x: ordinal type; Amount: Integer);

For pointer types:

    procedure Inc (var p: any pointer type);

or

    procedure Inc (var p: any pointer type; Amount: Integer);

### Description

For ordinal types, ``inc'` increases the value of ``x'` by one or by ``amount'` if it is given.

If the argument ``p'` is pointing to a specified type (typed pointer), ``inc'` increases the address of ``p'` by the size of the type ``p'` is pointing to or by ``amount'` times that size respectively. If ``p'` is an untyped pointer (i.e. ``p'` is of type section 9.196 Pointer), ``p'` is increased by one.

### Conforming to

``Inc'` is a Borland Pascal extension. Yet application of ``Inc'` to pointers is defined in Borland Pascal. The combination of the second argument with application to pointers is a GNU extension.

### Example

    program IncDemo;
    var
      Foo: Integer;
      Bar: array [1 .. 5] of Integer;
      Baz: ^Integer;
    begin
      Foo := 4;
      Inc (Foo, 5);      { yields 9 }
      {$X+}              { Turn on extended systax }
      Baz := @Bar[1];    { Baz points to y[1] }
      Inc (Baz, 2);      { Baz points to y[3] }
    end.

### See also

section 9.59 Dec, section 9.201 Pred, section 9.271 Succ, section 8.6 Pointer Arithmetics.

This document was generated by Frank Heckenbach on May, 10 2002 using texi2html