3 min read
typedef
Prerequisites: Structs
typedef gives an existing type a new name — most commonly used to
drop the repeated struct keyword:
typedef struct {
int x;
int y;
} Point;
Point p = {3, 4}; // no "struct" needed anymore
It works for any type, not just structs:
typedef unsigned long ulong;
ulong distance = 1000;