TMC - 10 Digital Tech Semester 2
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto mode

types

Kind of informationNameMain typeOther types
whole numbersintegerintuint, sbyte, byte, short, ushort, long, ulong
decimals in scientific notationfloating point numberdoublefloat
true/falsebooleanbool
textstringstring
individual letters, digitscharacterchar

Boolean

bool

Integer

Integers are whole numbers: positive, negative or zero. When you declare an integer you need to tell the computer how much space (how many digits) you need. On most modern systems, the default kind of integer (usually called int) is a 32-bit signed integer, which can store numbers between -2,147,483,648 and 2,147,483,647. Unless you have a good reason to choose differently, this is usually the best bet.

typelengthsignedrange
sbyte8 bitsy-128 to 127
byte8 bitsn0 to 255
short16 bitsy-32,678 to 32,767
ushort16 bitsn0 to 65,535
int32 bitsy-2,147,483,648 to 2,147,483,647
uint32 bitsn0 to 4,294,967,295
long64 bitsn-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
ulong64 bitsn0 to 18,446,744,073,709,551,615
char16 bitsn0 to 65,535

Floating point

Non-integer numbers in computers are usually stored as floating-point numbers, which are essentially numbers in scientific notation.

\[mantissa x 2^{exponent}\]

Text