![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-54939538x1.png)
2
A segmentation violation occurs when your program tries to reference memory outside your address space. The operating system detects this action and generates an error message. Following is an example program, SegViol.p, which contains a segmentation violation:
program SegmentationViolation; type
Pinteger = ^integer;
procedure ErrorInHere; var
IntVar: integer;
NullPtr: Pinteger; begin
NullPtr := nil;
{Next statement causes a SEGV } IntVar := NullPtr^;
end;
procedure Call1; procedure Call2; begin
ErrorInHere;
end; begin
Call2;
end;
begin Call1;
end.
Compiling and Running the ProgramWhen you compile and run the program, you receive output similar to the following. The first line indicates the name of the offending
14 | Pascal 4.0 User’s Guide |