11.2. Type NamesTo convert a value explicitly from one type to another using the cast operator, you must specify the new type by name. For example, in the cast expression (char *)ptr, the type name is char * (read: "char pointer" or "pointer to char"). When you use a type name as the operand of sizeof, it appears the same way, in parentheses. Function prototype declarations also designate a function's parameters by their type names , even if the parameters themselves have no names. The syntax of a type name is like that of an object or function declaration, but with no identifier (and no storage class specifier). Two simple examples to start with: unsigned char The type unsigned char. unsigned char * The type "pointer to unsigned char." In the examples that follow, the type names are more complex. Each type name contains at least one asterisk (*) for "pointer to," as well as parentheses or brackets. To interpret a complex type name, start with the first pair of brackets or parentheses that you find to the right of the last asterisk. (If you were parsing a declarator with an identifier rather than a type name, the identifier would be immediately to the left of those brackets or parentheses.) If the type name includes a function type, then the parameter declarations must be interpreted separately.
|