Node:Dec, Next:DefineSize, Previous:Date, Up:Reference

### Dec

#### Synopsis

For ordinal types:

    procedure Dec (var x: ordinal_type);

or

    procedure Dec (var x: ordinal_type; Amount: Integer);

For pointer types:

    procedure Dec (var p: any_pointer_type);

or

    procedure Dec (var p: any_pointer_type; Amount: Integer);

#### Description

For ordinal types, `Dec` decreases the value of `x` by one or by `amount` if specified.

If the argument `p` is pointing to a specified type (typed pointer), `Dec` decreases 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 decreased by one, otherwise by `amount` if specified.

#### Conforming to

`Dec` is a Borland Pascal extension. The combination of the second argument with application to pointers is a GNU Pascal extension.

#### Example

    program DecDemo;
    var
      x: Integer;
      y: array [1 .. 5] of Integer;
      p: ^Integer;
    begin
      x := 9;
      Dec (x, 10);  { yields -1 }
      {$X+}         { Turn on extended systax }
      p := @y[5];   { p points to y[5] }
      Dec (p, 3)    { p points to y[2] }
    end.

#### See also

Inc, Pred, Succ, Pointer Arithmetics.