I am reading Programming in C by Stephan G. Kochan
. He states that C has only five data types; int
, float
, double
, char
He states that C has only five data types; int, float, double, char and _Bool.
That's quite an over-simplification. Maybe intentional, if the book is aimed towards beginners.
If you go through C11 6.2.5 it lists the following distinct data types:
Character types (6.2.5/15)
char
signed char
unsigned char
Standard signed integer types (6.2.5/4)
signed char
short int
int
long int
long long int
Standard unsigned integer types (6.2.5/5)
_Bool
unsigned char
unsigned short int
unsigned int
unsigned long int
unsigned long long int
Real floating types (6.2.5/10)
float
double
long double
Complex types (6.2.5/11)
float _Complex
double _Complex
long double _Complex
Enumerated type (6.2.5/16)
enum {}
void type (6.2.5/19) (void type is an incomplete type)
void
Derived types (6.2.5/20)
Formally the term is type specifier 6.7.2:
type-specifier:
void
char
short
int
long
float
double
signed
unsigned
_Bool
_Complex
atomic-type-specifier
struct-or-union-specifier
enum-specifier
typedef-name
At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each struct declaration and type name. Each list of type specifiers shall be one of the following multisets (delimited by commas, when there is more than one multiset per item); the type specifiers may occur in any order, possibly intermixed with the other declaration specifiers.
— void
— char
— signed char
— unsigned char
— short, signed short, short int, or signed short int
— unsigned short, or unsigned short int
— int, signed, or signed int
— unsigned, or unsigned int
— long, signed long, long int, or signed long int
— unsigned long, or unsigned long int
— long long, signed long long, long long int, or signed long long int
— unsigned long long, or unsigned long long int
— float
— double
— long double
— _Bool
— float _Complex
— double _Complex
— long double _Complex
— atomic type specifier
— struct or union specifier
— enum specifier
— typedef name
As we can see, long
is a type specifier. It is not a type qualifier.