Declaring multiple types with typedef
suggest changeThe typedef
keyword is a specifier, so it applies separately to each declarator. Therefore, each name declared refers to the type that that name would have in the absence of typedef
.
int *x, (*p)(); // x has type int*, and p has type int(*)()
typedef int *x, (*p)(); // x is an alias for int*, while p is an alias for int(*)()
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents