Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

ShortInt

Deutsch · English · Français · Suomi · Русский

A shortint is a signed integer in the range of -128 to 127. The shortint is 8 bits long.

The Byte type is 8 bits long, too. But the byte datatype is an unsigned type, meaning that it encodes numbers from 0 to 255.

pascal

var
  a_shortint: shortint;
  a_byte : byte;
  s1, s2 : string;
begin
  a_shortint := %11110001;   // binary number
  a_byte     := %11110001;
  s1 := IntToStr(a_shortint); // s1 = '-15'
  s2 := IntToStr(a_byte);     // s2 = '241'

See also


From the Free Pascal wiki, page "ShortInt", as it stood on 2023-12-22 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 3, last changed by WikiArchive .