I stumbled upon some code where the typedef
keyword is in between the type and the alias name like in
int typedef INT;
It compiles
The typedef
keyword is classified as a storage class specifier in C, though the standard explicitly remarks that that's for convenience in expressing the formal language syntax. It nevertheless follows that typedef
can appear in exactly the same places that any other storage class specifier, such as extern
or static
, can appear. [C2011, 6.7.1/5]
In fact, the syntax allows storage-class specifiers to be intermixed with type specifiers, type qualifiers, and other "declaration specifiers" in declarations. [C2011, 6.7/1, 6.7/6]
Thus, yes, it is valid to put the typedef
keyword after the type name, as in your example.