Declarators and Variable Declarations
The rest of this section describes the form and meaning of declarations for variable types summarized in this list. In particular, the remaining sections explain how to declare the following:
Type of Variable
Single-value variables with integral or floating-point type
Variables composed of a collection of elements with the same type
Variables that point to other variables and contain variable locations (in the form of addresses) instead of values
Simple variables with integral type that hold one value from a set of named integer constants
Variables composed of a collection of values that can have different types
Variables composed of several values of different types that occupy the same storage space
A declarator is the part of a declaration that specifies the name that is to be introduced into the program. It can include modifiers such as * (pointer-to) and any of the Microsoft calling-convention keywords.
In the declarator
__declspec(thread) char *var;
char is the type specifier, __declspec(thread) and * are the modifiers, and var is the identifier's name.
END Microsoft Specific
You use declarators to declare arrays of values, pointers to values, and functions returning values of a specified type. Declarators appear in the array and pointer declarations described later in this section.
When a declarator consists of an unmodified identifier, the item being declared has a base type. If an asterisk (*) appears to the left of an identifier, the type is modified to a pointer type. If the identifier is followed by brackets ([ ]), the type is modified to an array type. If the identifier is followed by parentheses, the type is modified to a function type. For more information about interpreting precedence within declarations, see Interpreting More Complex Declarators.
Each declarator declares at least one identifier. A declarator must include a type specifier to be a complete declaration. The type specifier gives the type of the elements of an array type, the type of object addressed by a pointer type, or the return type of a function.
int list; // Declares an array of 20 int values named list char *cp; // Declares a pointer to a char value double func( void ); // Declares a function named func, with no // arguments, that returns a double value int *aptr // Declares an array of 10 pointers
The Microsoft C compiler does not limit the number of declarators that can modify an arithmetic, structure, or union type. The number is limited only by available memory.
END Microsoft Specific