char
unsigned char uses all available bits to represent the value
signed char reserves one bit for a sign flag (to switch
between positive and negative values)
unsigned char can hold values between 0 and 255
signed char can hold values between -127 and 127
signed or unsigned
qualifier, char may use whichever representation is more
efficient on the target machine
unsigned char a
signed char b
char ch
int
char, an int can be
signed or unsigned
signed qualifier is the default on all
int types (that is, int and signed int
mean the same thing, making the signed qualifier optional)
int - short int,
int, and long int
int is usually the most efficient fundamental datatype because
it is normally the same size as a machine word
ints
short int is smaller than or the same size as int
long int is larger than or the same size as int
short int and long int, the int
is optional.
int i
signed i (same as int i)
unsigned j
short smaller
unsigned short small
long large
unsigned long largest
char and int
types are defined in the <limits.h> file
CHAR_BIT 8 /* number of bits in a 'char' */ SCHAR_MIN -127 /* minimum value for 'signed char' */ SCHAR_MAX 127 /* maximum value for 'signed char' */ UCHAR_MAX 255 /* maximum value for 'unsigned char' */ SHRT_MIN -32767 /* minimum value for '(signed) short (int)' */ SHRT_MAX 32767 /* maximum value for '(signed) short (int)' */ USHRT_MAX 65535 /* maximum value for 'unsigned short' */ INT_MIN -32767 /* minimum value for '(signed) int' */ INT_MAX 32767 /* maximum value for '(signed) int' */ UINT_MAX 65535 /* maximum value for 'unsigned int' */ LONG_MIN -2147483647 /* minimum value for '(signed) long (int)' */ LONG_MAX 2147483647 /* maximum value for '(signed) long (int)' */ ULONG_MAX 4294967295 /* maximum value for 'unsigned long (int)' */
char is an unsigned value, these values are also defined:
CHAR_MIN 0 CHAR_MAX UCHAR_MAX
char is signed):
CHAR_MIN SCHAR_MIN CHAR_MAX SCHAR_MAX
float, double and long double
have the same relation to each other that the integer short,
int and long types have
double is usually the most efficient real number representation
float is smaller than or the same size as double
long double (which is an ANSI C invention) is larger than or
the same size as double
(a / b) * b
will almost never yield the original value of a
float f
double dbl
long double huge
float and
double types are defined in the <float.h>
file