Previous: Move procedure To the Table of Content Next: Odd function

- 4.62.2.54 -
Standard Units
System Unit
System Unit Procedures and Functions

New procedure

Targets: MS-DOS, OS/2, Win32


System Unit

Creates a new dynamic variable and sets a pointer variable to point to it.

Declaration:
  procedure New(Var P: Pointer);
Remarks:
New determines the amount of heap to allocate by the size of the typed variable pointed to by P. To reference the new variable, use P^. If New finds that there is an insufficient amount of free heap, a runtime error is generated.

Note that the size of heap variables is not limited to 66,535 (64K) bytes.

Example:
{$ifndef __CON__}
  This program must be compiled as console application only
{$endif}
var
  P: ^String[16];
begin
  New(P);
  P^ := 'How are you?';
  Writeln(P^);
  Dispose(P);
end.
See also:
Dispose


Previous: Move procedure To the Table of Content Next: Odd function
Move procedure Table of Content Odd function

- 4.62.2.54 -