Hello, functions are executed from left to right, and it seems so with the WriteLn in atoi function. However this program displays:
1 2 3 3 2 1 wy is it the way around in the function Test ? Can someone explain this technically ? Probably I miss something but I cannot see wy ? function atoi(var P: PChar): integer; begin Result := 0; while P^ in [' ', ':', '/'] do Inc(P); while P^ in ['0'..'9'] do begin Result := Result * 10 + Ord(P^) - $30; Inc(P); end; WriteLn(Result); end; procedure Test(h, m, s: word); begin WriteLn(h); WriteLn(m); WriteLn(s); end; procedure TForm1.FormCreate(Sender: TObject); var P: PChar; begin AllocConsole; P := '1:2:3'; Test(atoi(P), atoi(P), atoi(P)); end; --- Rgds, Wilfried http://www.mestdagh.biz __________________________________________________ Delphi-Talk mailing list -> Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk