A type name is syntactically
a declaration of an object or a function of a given type that omits
the identifier. Type names are often used in cast expressions and
as operands of the sizeof operator.
Syntax |
 |
type-name ::=[LINEBREAK] specifier-qualifier-list [abstract-declarator][LINEBREAK] [LINEBREAK]abstract-declarator ::=[LINEBREAK] pointer[LINEBREAK]
[pointer] direct-abstract-declarator[LINEBREAK] [LINEBREAK]direct-abstract-declarator[LINEBREAK] (abstract-declarator )[LINEBREAK]
[direct-abstract-declarator] [ [constant-expression] ][LINEBREAK] [direct-abstract-declarator] ( [parameter-type-list] )
Description |
 |
Type names are enclosed in parentheses to indicate
a cast operation. The destination type is the type named in the cast;
the operand is then converted to that type.
A type name is a declaration without the identifier
specified. For example, the declaration for an integer is int i. If the identifier is omitted, only the integer
type int remains.
Examples |
 |
int int[LINEBREAK] int * Pointer to int[LINEBREAK] int () Function returning an
int[LINEBREAK] int *() Function
returning a pointer to int[LINEBREAK] int (*)()
Pointer to function returning an int[LINEBREAK] int [3]; Array of 3 int[LINEBREAK] int *[3]; Array of 3 pointers
to int[LINEBREAK] int (*)[3]; Pointer
to an array of 3 int
The parentheses are necessary to alter the binding
order in the cases of pointer to function and pointer to array. This
is because function and array declarators have higher precedence than
the pointer declarator.