Consider a structure whose tag is awkward to repeat: typedef struct birdStruct birdStruct; struct birdStruct { ... }; The first declaration gives struct birdStruct the shorter name birdStruct. A typedef introduces an alias for an existing C type; it does not create a distinct type. section 6.4
Use typedef for several kinds of existing types:
- Give a structure a convenient name, including through a forward declaration: typedef struct toto toto; then use toto* in an interface. section 6.4 section 11.2
- Alias arrays and compose aliases: typedef double matrix[16][64]; makes matrix B and double C[16][64] the same type. section 6.4
- Remember that names ending in _t are reserved; the C standard uses this convention for typedef names such as size_t. section 6.4
Keep pointers visible
typedef struct toto toto; toto* toto_get(void); void toto_destroy(toto*); void toto_doit(toto*, unsigned); This shortens the structure spelling without hiding that the interface accepts pointers. Hiding the pointer itself inside typedef toto is discouraged because it conceals that a null pointer may be meaningful. section 11.2
TAKEAWAY: typedef supplies another name, not another entry in C’s type system. It resembles a naming macro, but the alias participates as a type declaration. section 6.0 section 6.4

