ex83.pp 579 B

12345678910111213141516171819202122232425262728293031
  1. Program example83;
  2. { Program to demonstrate the Assigned function }
  3. Procedure DoSomething;
  4. begin
  5. Writeln ('Hello from doseomething!')
  6. end;
  7. Type
  8. TProcType = Procedure;
  9. Var P : Pointer;
  10. Procvar : TProcType;
  11. begin
  12. P:=Nil;
  13. If not Assigned(P) then
  14. Writeln('P is nil');
  15. Getmem(P,1000);
  16. If Assigned(P) Then
  17. writeln ('P Points in the heap.');
  18. FreeMem(P,1000);
  19. procvar:=@DoSomething;
  20. If Assigned(ProcVar) then
  21. Writeln ('Procvar is non-nil');
  22. procvar:=TProcType(Nil);
  23. If Not Assigned(Procvar) then
  24. Writeln ('Procvar is nil');
  25. end.