Explicit conversion to 8-bit integer: CSByte, CByte, shortint
The required type conversion can be carried out as follows:explicit conversion to 8-bit integer
Description
( type ) expression
Input
- type - 8-bit integer
- expression - Expressions
Output
- return - 8-bit integer
Note: In C like languages the data type size may be different depending on compiler and architecture, we show only one standard look.
Examples
Example
Explicit conversion to 8-bit integer the possible of use:xmin = -128; ymax = 127;
sbyte x= -5; // x = -5
sbyte y = -(15 % 4); // y = -3
y = (sbyte)(x * y); // z = 15
CSByte
Description
CSByte (expr)
Input
- expr - Any
Output
- return - 8-bit integer
Examples
Visual Basic .NET
Explicit conversion to 8-bit integer the possible of use:xmin = -128
ymax = 127
Dim x As sbyte= -5 ' x = -5
Dim y As sbyte= -(15 mod 4) ' y = -3
y = CSByte((x * y)) ' z = 15
CByte
Description
CByte (expr)
Input
- expr - Any
Output
- return - 8-bit integer
Examples
FreeBASIC
Explicit conversion to 8-bit integer the possible of use:xmin = -128
ymax = 127
Dim x As byte= -5 ' x = -5
Dim y As byte= -(15 mod 4) ' y = -3
y = CByte((x * y)) ' z = 15
shortint
Description
shortint (expr)
Input
- expr - Any
Output
- return - 8-bit integer
Examples
Object Pascal
Explicit conversion to 8-bit integer the possible of use:xmin := -128; ymax := 127;
x:= -5; // x = -5
y:= -(15 mod 4); // y = -3
y := shortint((x * y)); // z = 15
You can find it in the following collections: explicit type conversions
Explicit conversion to 8-bit integer in another programming language: