Page 11 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 11
Fundamentals of Data Structures
Notes 1.2.1 Integer Types
Integer types include signed and unsigned integer types. These are discussed as below.
C Signed Integer Types
C provides five signed integer types. Each integer type has several synonyms.
Table 1.1 illustrates the first five integer types with their corresponding synonyms:
Table 1.1: First Five Integer Types
Integer Types Synonyms Notes
signed char
int Signed, signed int
short Short int, signed short, signed short int
long Long int, signed long, signed long int
long Long long int, signed long long, Signed Available
long long int Since C99
C Unsigned Integer Types
For each signed integer, C also provides the corresponding unsigned integer type that has the
same memory size as the signed integer type.
Table 1.2 illustrates the unsigned integer type:
Table 1.2: Unsigned Integer Types
Signed Integer Types Unsigned Integer Types
char unsigned char
int unsigned int
short unsigned short
long unsigned long
long long unsigned long long
C Integer Types Value Ranges
C defines exactly minimum storage size of each integer type, e.g. short takes at least two byes,
long takes at least 4 bytes. Regardless of the C’s implementation, the size of integer types must
follows the order below:
sizeof(short) < sizeof(int) < sizeof(long) < sizeof(long long)
4 LOVELY PROFESSIONAL UNIVERSITY