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

## 9.59 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 section 9.196 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 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

section 9.115 Inc, 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