Program NullAllVars;
{ A SIMPLE MEANS TO NULL ALL VARIABLES IN A PASCAL PROGRAM }
{ I USE THIS AS THE FIRST LINE OF ANY PROGRAM I WRITE. IT  }
{ SET ALL VARIABLES TO NULL SO THERE IS NO JUNK IN         }
{ UN-INITIALIZED VARIABLES.				   }

Uses Crt;

Var
  FirstVar : Byte;   { Must be First Variable in Var List }

  Test1    : String;
  Test2    : Real;
  Test3    : String;
  Test4    : String;
  Test5    : Integer;
  Test6    : String;
  Test7    : String;
  Test8    : String;
  Test9    : String;

  LastVar  : Byte;  { Must be Last Variable in Var List }

begin
  ClrScr;
  { Put Junk in Vars For Test }
  Test1 := 'Junk1 in String';
  Test2 := 1234567.635;
  Test3 := 'Junk3 in String';
  Test4 := 'Junk4 in String';
  Test5 := 12345;

  { Show Junk in Vars }
  Writeln(' Before Nulling Vars ');
  Writeln('---------------------');
  writeln('Test1 - ',Test1);
  writeln('Test2 - ',Test2);
  writeln('Test3 - ',Test3);
  writeln('Test4 - ',Test4);
  writeln('Test5 - ',Test5);


  { Null all Strings Etc }
  FillChar(FirstVar, Ofs(LastVar) - Ofs(FirstVar) + Sizeof(LastVar), 0);

  Writeln;
  writeln;
  Writeln(' Aftre Nulling Vars');
  Writeln('--------------------');
  writeln('Test1 - ',Test1);
  writeln('Test2 - ',Test2);
  writeln('Test3 - ',Test3);
  writeln('Test4 - ',Test4);
  writeln('Test5 - ',Test5);
end.
