Data types
There are 2 data types
a. Integer
b. Float
Integer Data types
Char (Character)
· Size: Typically, 1 byte (8 bits)
· Range:
· Signed: -128 to 127
· Unsigned: 0 to 255
· Usage: Used to store single characters such as ‘A’, ‘b’, ‘1’, etc. It can also be used to store small integers.
· Example:
char letter = ‘A‘;
Int (Integer)
· Size: Typically, 4 bytes (32 bits) on most modern systems, though it can vary based on the system and compiler.
· Range:
· Signed: -2147483648 to 2147483647
· Unsigned: 0 to 4294967295
· Usage: Used to store whole numbers without any fractional or decimal part.
· Example:
int number = 100;
short
· Size: 2 bytes (16 bits).
· Range
· Signed Range: -32,768 to 32,767
· Unsigned Range: 0 to 65,535
long
· Size: 4 bytes (32 bits).
· Range:
· Signed Range: -2,147,483,648 to 2,147,483,647
· Unsigned Range: 0 to 4,294,967,295
long long
· Size: 8 bytes (64 bits).
· Range:
· Signed Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
· Unsigned Range: 0 to 18,446,744,073,709,551,615