SystemSwap (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

Th following console application uses the Swap function to exchange the two low order bytes of an integer variable.

Code

program ProjectSwap;
{$APPTYPE CONSOLE}

uses
  SysUtils;

  var
  X: Integer;
begin
  X := $A0B1C2D3;
  Writeln(Format('$%.8x', [Swap(X)]));
end. { Put breakpoint here to see the console output }

Console output

$A0B1D3C2

Uses