Explicit conversion to 32-bit integer: CInt, CLong, integer, longint
The required type conversion can be carried out as follows:explicit conversion to 32-bit integer
Description
( type ) expression
Input
- type - 32-bit integer
- expression - Expressions
Output
- return - 32-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 32-bit integer the possible of use:xmin = -2147483648; ymax = 2147483647;
int x= -12345; // x = -12345
int y = -(15123 div 70);// y = -216
z = (int)(x * y); // y = 2666520
CInt
Description
CInt (expr)
Input
- expr - Any
Output
- return - 32-bit integer
Examples
Visual Basic .NET
Explicit conversion to 32-bit integer the possible of use:xmin = -2147483648
ymax = 2147483647
Dim x As integer= -12345 ' x = -12345
Dim y As integer= -(15123 \ 70)' y = -216
z = CInt((x * y)) ' y = 2666520
CLong
Description
CLong (expr)
Input
- expr - Any
Output
- return - 32-bit integer
Examples
Basic
Explicit conversion to 32-bit integer the possible of use:xmin = -2147483648
ymax = 2147483647
Dim x As long= -12345 ' x = -12345
Dim y As long= -(15123 \ 70)' y = -216
z = CLong((x * y)) ' y = 2666520
integer
Description
integer (expr)
Input
- expr - Any
Output
- return - 32-bit integer
Examples
Object Pascal
Explicit conversion to 32-bit integer the possible of use:xmin := -2147483648; ymax := 2147483647;
x:= -12345; // x = -12345
y:= -(15123 div 70);// y = -216
z := integer((x * y)); // y = 2666520
longint
Description
longint (expr)
Input
- expr - Any
Output
- return - 32-bit integer
Examples
Object Pascal
Explicit conversion to 32-bit integer the possible of use:xmin := -2147483648; ymax := 2147483647;
x:= -12345; // x = -12345
y:= -(15123 div 70);// y = -216
z := integer((x * y)); // y = 2666520
You can find it in the following collections: explicit type conversions
Explicit conversion to 32-bit integer in another programming language: