Names specified here
Name Description Notes Source Availability
char Specifier for integer types L Q Keyword C89 C90 C95 C99 C11
double Specifier for floating-point types L Q Keyword C89 C90 C95 C99 C11
float Specifier for floating-point types L Q Keyword C89 C90 C95 C99 C11
int Specifier for integer types L Q Keyword C89 C90 C95 C99 C11
long Specifier for integer and floating-point types L Q Keyword C89 C90 C95 C99 C11
short Specifier for integer types L Q Keyword C89 C90 C95 C99 C11
void Specifier for empty type, generic pointer type and empty parameter list L Q Keyword C89 C90 C95 C99 C11

In C, a type denotes a set of distinct interchangable values. Every object has a type, indicating the set of possible values it can hold. Every expression has a type, determined by the types of the primitive expressions it is made from, and the operators that combine them. C has several native types and several ways to construct new types.

The native types are identified by combinations of the following keywords:

type-specifier
void
char
short
int
long
float
double
signed
unsigned
_Bool
since C99
_Complex
since C99
_Imaginary
since C99

From these are built the basic types, which include the integer types and the floating-point types:

[ Work in progress : But this list includes complex types too. Do basic types include complex FP types?]

Other types can built out of structures, unions, enumerations, arrays and pointers, and alternative names for existing types can be defined with typedef.

The aggregate types are array types and structure types, i.e., those that have distinct identifiable components.

The derived types are array types, structure types, union types, pointer types and function types. All these types are defined in terms of other types, possibly recursively.

Types are identified in two ways. In a declaration, the name of an object, function or type alias is embedded in the type:

int arri[10];
int *arrpi[10];
int (*parri)[10];

arri, arrpi and parri are the names of objects being declared, and the type information surrounds them, i.e., arri is an array of 10 ints; arrpi is an array of 10 pointers to ints; parri is a pointer to an array of 10 ints. Of course, it is often simpler than that, with trivially simple embedding:

int x;

In some contexts, only the type can be identified, using the grammar of type-name:

generic-association
type-name : assignment-expression
unary-expression
sizeof ( type-name )
_Alignof ( type-name )
postfix-expression
( type-name ) { initializer-list }
since C99; Structures
( type-name ) { initializer-list , }
since C99; Structures
cast-expression
( type-name ) cast-expression
alignment-specifier
_Alignas ( type-name )
atomic-type-specifier
_Atomic ( type-name )
type-name
specifier-qualifier-list abstract-declaratoropt
specifier-qualifier-list
type-specifier specifier-qualifier-listopt
type-qualifier specifier-qualifier-listopt
type-specifier
void
char
short
int
long
float
double
signed
unsigned
_Bool
since C99
_Complex
since C99
_Imaginary
since C99
atomic-type-specifier
since C11
struct-or-union-specifier
enum-specifier
typedef-name
struct-or-union-specifier
struct-or-union identifieropt { struct-declaration-list }
struct-or-union identifier
typedef-name
identifier
struct-or-union
struct
union
struct-declaration-list
struct-declaration
struct-declaration-list struct-declaration
struct-declaration
specifier-qualifier-list struct-declarator-listopt ;
static_assert-declaration
since C11
struct-declarator-list
struct-declarator
struct-declarator-list struct-declarator
struct-declarator
declarator
declaratoropt : constant-expression

The type-name identifying arri is int[10], arrpi is int *[10], and parri is int (*)[10].


CHaR
Made with Mokvino
Sitemap Supported
Site format updated 2019-05-02T08:34:41.381+0000
Data updated 2018-07-27T14:21:54.073+0000
Page updated 2020-06-25T02:21:23.674+0000