Explicit conversion to 16-bit integer: CShort, CInt, smallint, integer

The required type conversion can be carried out as follows:

explicit conversion to 16-bit integer

Description

( type ) expression

Input


Output

Note: In C like languages the data type size may be different depending on compiler and architecture, we show only one standard look.
Compatible programing languages:
C | Visual C++ .NET | C++ | C# | Java

Examples

Example

Explicit conversion to 16-bit integer the possible of use:
xmin = -32768; ymax = 32767;
short x= -1234;        // x = -1234
short y = -(1500 % 60);// y = -25
y = (short)(x * y);    // z = 30850

CShort

Description

 CShort (expr)
Used keywords: cshort

Input


Output

Compatible programing languages:
Visual Basic .NET | FreeBASIC

Examples

Visual Basic .NET

Explicit conversion to 16-bit integer the possible of use:
xmin = -32768
 ymax = 32767
Dim x As short= -1234        ' x = -1234
Dim y As short= -(1500 mod 60)' y = -25
y = CShort((x * y))    ' z = 30850

CInt

Description

 CInt (expr)
Used keywords: cint

Input


Output

Compatible programing languages:
Basic

Examples

Basic

Explicit conversion to 16-bit integer the possible of use:
xmin = -32768
 ymax = 32767
Dim x As integer= -1234        ' x = -1234
Dim y As integer= -(1500 mod 60)' y = -25
y = CInt((x * y))    ' z = 30850

smallint

Description

 smallint (expr)
Used keywords: smallint

Input


Output

Compatible programing languages:
Free Pascal | Object Pascal

Examples

Object Pascal

Explicit conversion to 16-bit integer the possible of use:
xmin := -32768; ymax := 32767;
x:= -1234;        // x = -1234
y:= -(1500 mod 60);// y = -25
y := smallint((x * y));    // z = 30850

integer

Description

 integer (expr)
Used keywords: integer

Input


Output

Compatible programing languages:
Pascal

Examples

Pascal

Explicit conversion to 16-bit integer the possible of use:
xmin := -32768; ymax := 32767;
x:= -1234;        { x = -1234}
y:= -(1500 mod 60);{ y = -25}
y := integer((x * y));    { z = 30850}

You can find it in the following collections: explicit type conversions
Explicit conversion to 16-bit integer in another programming language:
Languages: en hu cz sk