C++ Reference
Variable Types
char
This is the smallest type in C, and is constrained to be
at least 8-bits, or one byte. This is most typically used for actual
typed characters, and each of the values herein can be represented as some
character in ASCII code. Sometimes, arrays or pointers to these are
used for string processing, specifically in C programs.
The range of this variable is -127 to 128, if signed, or
0 to 255 if unsigned (2^8).
short
This is defined to be at least double the size of a char
variable, and at least 16-bits, at most this can be the size of an int,
but it is supposed to be one half the bits of an int, or 16 bits, which
ever is more. This is most typically used as a wide-char (wchar,
ctype.h), or an international character. Though it is just a generally
good value for small variables.
The range of this variable is -32 if signed,
or 0 to 65536 if unsigned (2^16).
int
An int is one of the most basic types in C. This is
equivalent to the general purpose register size on the target machine.
This is usually 32-bits, but on old machines can be 16-bits, and on new
machines, this can be 64-bits. Usually though, it is 32 bits, and
if the machine has 64-bit registers, then these are usually referred to
as longs.
Ints can be operated on using arithmetic operations, bitwise
operations or just about anything else. They are an actual representation
of a register in the target machine, and are therefore stored exactly how
the machine would store the number. This means that negative numbers
will look very strange if looked at in their pure bit forms.
These are the default type in C/C++ for a variable, so in
an implicit function declaration, this will be the type that the compiler
will assume that the function returns.