I believe that local integer variables are not initialized to zero in delphi. The initial value is whatever happens to be at that memory location. So in the code below the first time the button is clicked the first message shows a integer value. How come the second time it's clicked it doesn't show 3 but instead shows the same integer value? It continues to show the same integer value each time I click the button. The value is different only when I stop and restart the program. Where is 3 being stored as it looks like the same memory location is used each time the button is clicked in the same run of the program?
procedure TForm1.Button1Click(Sender: TObject);
var
int1 : integer;
begin
showmessage(inttostr(int1)) ;
int1 := 3;
end;
end.