int is used to define integer numbers.
{
int Count;
Count = 8;
}
Integers are whole numbers with a machine dependent range of values. C has 3 classes of integer storage namely short int, int and long int. All of these data types have signed and unsigned forms. A short int requires half the space than normal integer values. Unsigned numbers are always positive and consume all the bits for the magnitude of the number. The long and unsigned integers are used to declare a longer range of values.
type bytes bits range
short int 2 16 -32,768 to +32,767
int 4 32 -2,147,483,648 to +2,147,483,647
long int 4 32 -2,147,483,648 to +2,147,483,647
float is used to define floating point numbers.
{
float Miles;
Miles = 8.6;
}
Floating point number represents a real number with 6 digits precision. Floating point numbers are denoted by the keyword float.
double is used to define BIG floating point numbers. It reserves twice the storage for the number. On PCs this is likely to be 8 bytes.
{
double Atoms;
Atoms = 4500000;
}
char defines characters.
{
char Letter;
Letter = ‘x’;
}
A single character can be defined as a defined as a character type of data. Characters are usually stored in 8 bits of internal storage. The qualifier signed or unsigned can be explicitly applied to char.
