VMS Help CC, Language topics, Data Types, typedef *Conan The Librarian (sorry for the slow response - running on an old VAX) |
Use the typedef keyword to define an abbreviated name, or synonym, for a lengthy type definition. Grammatically, typedef is a storage-class specifier, so it can precede any valid declaration. In such a declaration, the identifiers name types instead of variables. For example: typedef char CH, *CP, STRING[10], CF(); In the scope of this declaration, CH is a synonym for "character," CP for "pointer to character," STRING for "10-element array of characters," and CF for "function returning a character." Each of the type definitions can be used in that scope to declare variables. For example: CF c; /* c IS A FUNCTION RETURNING A CHARACTER */ STRING s; /* s IS A 10-CHARACTER STRING */
|