Structs & Data Structures · beginner · ~8 min
Give types nicer names.
typedef creates an alias for an existing type. Most common use: drop the struct keyword from every site of use.
Don't abuse it — hiding pointer types behind a typedef (typedef foo_t *foo_handle) makes ownership/lifetime invisible to readers. Reserve typedef for value types and opaque handles.
typedef struct point { double x, y; } point_t;
point_t p = {1.0, 2.0};
_t suffix (point_t), others don't. Be consistent.typedef foo *foo_p;) — usually a readability loss.