ShortInt: Difference between revisions
From Free Pascal wiki
Jump to navigationJump to search
(Created page with "{{Shortint}} 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 unsi...") |
(Use pascal highlighter) |
||
Line 6: | Line 6: | ||
<syntaxhighlight> | <syntaxhighlight lang=pascal> | ||
var | var |
Revision as of 17:34, 29 January 2020
│
English (en) │
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.
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
- function OnesComplement2
- Smallint is integer type supporting values from -32768 to 32767
- binary numbers
- IntToStr convert an integer into a string
simple data types |
|
---|---|
complex data types |