Type Declarations Syntax
The syntax of a type declaration is:
typedef type_specification typedef_name {, typedef_name};
Syntax Notes:
• The typedef keyword acts somewhat like a storage class specifier in a variable declaration, the only difference being that the resulting typedef_name is marked as a type name and not as a variable name.
• The type_specification must be an embedded SQL/C type known to the preprocessor, a type built up with a typedef declaration, or a structure or union specification. Structures are discussed in more detail later.
• Use an asterisk (*) before the typedef_name to denote a pointer type, or follow it with a bracketed expression ([expr]) to denote an array type. Pointers and arrays are discussed in more detail later.
• The preprocessor accepts an initial_value after typedef_name, although you should avoid putting one there because it does not signify anything. Most C compilers allow an initial_value that is ignored after the typedef_name.
• Once you declare a typedef name, it is reserved for all subsequent declarations in the current scope. Thus variable names (including variable names that are names of fields in structure declarations) cannot have the same name as a previously defined typedef name.
Example: Type declarations usage
typedef short INTEGER2;
typedef char CHAR_BUF[2001], *CHAR_PTR;
INTEGER2 i2;
CHAR_BUF logbuf;
CHAR_PTR name_ptr = (char *)0;