fork download
  1. program typed;
  2. {$IF Defined(FPC)}
  3. {$MODE Delphi}
  4. {$ENDIF}
  5.  
  6. uses SysUtils;
  7.  
  8. type
  9. TCoor = record
  10. x, y: Integer;
  11. end;
  12.  
  13. var
  14. c: TCoor;
  15. p: Pointer;
  16.  
  17. function Eval(var u): Pointer;
  18. begin
  19. TCoor(u).x := 2;
  20. TCoor(u).y := 2;
  21. Result := @u;
  22. end;
  23.  
  24. begin
  25. c.x := 1;
  26. c.y := 1;
  27. WriteLn(Format('x - %d', [c.x]));
  28. WriteLn(Format('y - %d', [c.y]));
  29. WriteLn(Format('p - %p', [@c]));
  30. p := Eval(c);
  31. WriteLn(Format('x - %d', [c.x]));
  32. WriteLn(Format('y - %d', [c.y]));
  33. WriteLn(Format('p - %p', [p]));
  34. end.
Success #stdin #stdout 0s 5604KB
stdin
Standard input is empty
stdout
x - 1
y - 1
p - 0000000000472460
x - 2
y - 2
p - 0000000000472460