Node:Inc, Next:Include, Previous:in, Up:Reference

### 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 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 Pascal 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

Dec, Pred, Succ, Pointer Arithmetics.