C Now

C Types

Site Logo
  • C is weakly typed.
  • Automatic type conversions (type casts) are performed in expressions.
  • C typing is structural.
  • The C specification does not define the actual sizes of the basic types.  There are rules about their relative sizes.
  • Actual type sizes are implementation dependent.
Basic C Data Types
Type  Description  16 bit  32 bit 
size  range  size  range 
char fixed point binary 1 [0, 255]
or
[-128, 127]
1 [0, 255]
or
[-128, 127]
int fixed point binary 2 [-32,768, 32,767] 4 [- 2,147,483,648, 2,147,483,647]
float floating-point binary 4 (-3.40282 * 1038, -1.17549 * 10-38),
0, and
(1.17549 * 10-38, 3.40282 * 10-38)
4 (-3.40282 * 1038, -1.17549 * 10-38),
0, and
(1.17549 * 10-38, 3.40282 * 10-38)
double floating-point binary 8 (-1.79769 * 10308, -2.22507 * 10-308),
0, and
(2.22507 * 10-308, 1.79769 * 10308)
8 (-1.79769 * 10308, -2.22507 * 10-308),
0, and
(2.22507 * 10-308, 1.79769 * 10308)
Notes:
  • The char type can be either signed or unsigned.  The choice is controlled by a compiler switch. 
Modified C Data Types
Type  Description  16 bit  32 bit 
Size  Range  Size  Range 
signed char fixed point binary 1 [-128, 127] 1 [-128, 127]
unsigned char fixed point binary 1 [0, 255] 1 [0, 255]
short
short int
signed short int
short signed int
signed short
short signed
fixed point binary 2 [-32,768, 32,767] 2 [-32,768, 32,767]
short unsigned int
unsigned short int
short unsigned
unsigned short
fixed point binary 2 [0, 65,537] 2 [0, 65,537]
int
signed
signed int
fixed point binary 2 [-32,768, 32,767] 4 [- 2,147,483,648, 2,147,483,647]
unsigned
unsigned int
fixed point binary 2 [0, 65,535] 4 [0, 4,294,967,295]
long
long int
signed long int
long signed int
signed long
long signed
fixed point binary 4 [-2,147,483,648, 2,147,483,647] 4 [-2,147,483,648, 2,147,483,647]
unsigned long int
long unsigned int
unsigned long
long unsigned
fixed point binary 4 [0, 4,294,967,295] 4 [0, 4,294,967,295]
long double floating-point binary 8 (-1.79769 * 10308, -2.22507 * 10-308)
0, and
(2.22507 * 10-308, 1.79769 * 10308)
8 (-1.79769 * 10308, -2.22507 * 10-308)
0, and
(2.22507 * 10-308, 1.79769 * 10308)
long double floating-point binary 10 (-1.18973 * 104932, -3.3621 * 10-4932),
0, and
(-3.3621 * 10-4932, 1.18973 * 104932)
10 (-1.18973 * 104932, -3.3621 * 10-4932),
0, and
(-3.3621 * 10-4932, 1.18973 * 104932)
Notes:
  • These values are typical, and may vary with different compilers.  In particular, the long double type is 8 bytes long in Microsoft Visual C++ version 4.2, and 10 bytes long in Borland C++ version 5.5.  The appropriate values for a given compiler can be determined by using symbolic constants. 
Symbolic Ranges
Type  Defined in  Range 
char limits.h [CHAR_MIN, CHAR_MAX]
signed char limits.h [SCHAR_MIN, SCHAR_MAX]
unsigned char limits.h [0, UCHAR_MAX]
short
short int
signed short
signed short int
limits.h [SHRT_MIN, SHRT_MAX]
unsigned short
unsigned short int
limits.h [0, USHRT_MAX]
int
signed int
limits.h [INT_MIN, INT_MAX]
unsigned int limits.h [0, UINT_MAX]
long
long int
signed long
signed long int
limits.h [LONG_MIN, LONG_MAX]
unsigned long
unsigned long int
limits.h [0, ULONG_MAX]
float float.h (-FLT_MAX, -FLT_MIN), 0, (FLT_MIN, FLT_MAX)
double float.h (-DBL_MAX, -DBL_MIN), 0, (DBL_MIN, DBL_MAX)
long double float.h (-LDBL_MAX, -LDBL_MIN), 0, (LDBL_MIN, LDBL_MAX)
C Now Home  C Now Home
Etymology Index  Etymology Index
E-Mail
Valid HTML 4.01 Transitional Valid CSS! Site Logo

copyright 2000-2006, j.h.young, revised 2/13/06