- 4.67.2.54. -
Table of Contents
4. Standard Units
4.67. System - Built-in routines
4.67.2. System Unit Procedures and Functions
4.67.2.54. New procedure
4.67.2.54. 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
- 4.67.2.54. -