There are only two major classes of types in C. Integer types and real/floating point number types. Everything else derives from them. Characters are just 8 bit integer numbers which use ASCII encoding. Boolean values are also just integers. 0 is False and everything else is True. You can also define your own data-structures and use them as types. More on that in a later section.
Here is a table of all the basic types in c with their bit sizes. The standard doesn't define all sizes exactly. So be care full. They can change from platform to platform or from compiler to compiler.
Type | Type name | Guaranteed Bit Size | Common Bit Size | Range |
---|---|---|---|---|
Integers |
char | 8 bits | 8 bits | 0-255 |
short | at least 16 bits | 16 bits | 0-65535 | |
int | at least 16 bits | 32 bits | 0-4294967295 | |
long | at least 32 bits | 64 bits | 0-18446744073709551615 | |
long long | at least 64 bits | 64 bits | 0-18446744073709551615 | |
RealNumbers |
float | 32 bits | 32 bits | 1.17549x10-38-3.40282x1038 |
double | 64 bits | 64 bits | 2.22507x10-308-1.79769308 |
With the keyword unsigned you specify that you only want to use positive numbers. That gives you a bigger positive range, but you wont be able to use negative numbers. The keyword signed does the opposite. It specifies that you also want to encode negative numbers. This shrinks your positive range, but you can use negative numbers. For example a unsigned char can store values between the numbers 0 and 255. The signed char stores values between -128 to 127.