The ONE core idea: typedef gives a second name to a type that already exists — nothing new is created, only a nickname. To read any typedef, you cover the word typedef, pretend the line is an ordinary variable declaration, and the "variable name" you find is the new type name.
Before you can trust that trick, you must know exactly what a type , a declaration , a variable name , a *, a struct, and a function pointer even are — as pictures, not just words. This page builds all of them from zero, in the order the parent note needs them.
A type is a label the compiler attaches to a box of memory that says two things : how many bytes the box is, and how to interpret the bits inside it (as a whole number, a character, an address, ...).
Look at the figure: the same 4 bytes of memory can mean different things depending on the type label glued to them. The label is the type; the bits are the same.
Why does the topic need this? Because typedef never touches the box — it only invents a new sticker you can put on boxes of that same size and meaning. Knowing "type = size + interpretation" is what lets you say confidently: an alias changes nothing about the box, only its name.
A declaration is a sentence that tells the compiler: "make a box of this type , and let me refer to it by this name ."
type int name x ;
Here x is the variable name — the human word we use to reach that box.
The picture below shows the anatomy: on the left the type, in the middle the name, on the right the semicolon that ends the sentence.
Why the topic needs this: typedef is literally a declaration with one extra word in front . If you can point to "where the name lives" in a plain declaration, you can point to "where the new type name lives" in a typedef. That single skill decodes every example in the parent note.
Worked example The one move that unlocks everything
Take int x;. Put typedef in front → typedef int Integer;. The slot where x used to sit now holds Integer, and Integer becomes a new name for int . Same shape, one word added.
The symbol ==*== in a declaration means "pointer to" — a box whose contents are the address of another box, not a value itself. int *p; reads "p is a pointer to int". See Pointers in C .
An address is just a house number for memory. In the figure, the box p does not hold 5; it holds an arrow (the address) pointing at the box that holds 5.
* binds to the NAME, not the type
Why it trips people: In int *p; it looks like * belongs to int.
The truth: it binds to p. That is why int *a, b; makes only a a pointer and b a plain int. This exact fact is why typedef int* IntPtr; IntPtr a, b; makes both pointers — the * got baked into the alias, so it can no longer split off. Hold onto this; the parent note's Example 3 depends on it entirely.
A ==struct== glues several boxes (called members ) into one bigger box. struct Point { int x, y; }; defines a box that holds two ints named x and y. See Structures in C .
The word after struct — here Point — is the tag . In C the tag lives in a separate namespace , so the full type name is the two words struct Point, not just Point.
That "two words every time" is annoying, which is precisely the itch typedef struct Point Point; scratches: it lets you drop the struct word and write just Point p;.
A function pointer is a box holding the address of a function , so you can call the function through it. Its type is written
int (*Operation)(int, int)
read as "Operation is a pointer to a function taking two ints and returning int". See Function Pointers .
Read the figure left-to-right with the decode trick: the parentheses (*Operation) group the * with the name (so it's a pointer), the trailing (int, int) says "to a function of two ints", and the leading int says "returning int".
Why the topic needs this: this notation is famously unreadable. typedef hides it behind one clean word Operation, so Operation table[4]; (an array of four such functions) becomes instantly legible. This is the strongest argument for typedef existing at all.
==#define== is a preprocessor command: before the compiler even runs, it does blind find-and-replace on your text. #define uint unsigned int literally pastes unsigned int wherever it sees uint.
#define is NOT typedef
Text replacement has no idea about the *-binds-to-name rule. #define INTPTR int* then INTPTR a, b; expands to int* a, b; → a is a pointer, b is an int. But typedef int* IntPtr; then IntPtr a, b; makes both pointers, because the compiler understands the alias as a whole type. Keep these two side by side — the parent note's central lesson lives right here.
Type is size plus interpretation
Declaration gives a box a name
Asterisk means pointer to
struct bundles boxes under a tag
Function pointer holds a functions address
Cover typedef read as declaration
typedef makes a new name for a type
hash define is blind text replace
What is a type made of (two things)? A size in bytes plus a rule for interpreting the bits.
In int x;, which word is the type and which is the name? int is the type, x is the variable name.
What is the one-move decode trick for a typedef? Cover the word typedef, read the rest as a variable declaration; the "variable name" is the new type name.
What does * mean in a declaration, and what does it bind to? "Pointer to"; it binds to the name , not the base type.
In int *a, b;, what are a and b? a is int *, b is a plain int.
Why must you normally write struct Point p; and not Point p;? The tag Point lives in the struct namespace, so the full type name is the two words struct Point.
Read int (*Operation)(int,int) in words. Operation is a pointer to a function taking two ints and returning int.
Core difference between #define and typedef? #define is blind preprocessor text replacement; typedef is a real compiler-level type alias that respects the *-binds-to-name rule.
Parent: Typedef — this page supplies every symbol that note assumes.
Structures in C — the struct/tag foundation from §3.
Pointers in C — the * foundation from §2.
Function Pointers — the ugly type tamed in §4.
Linked Lists — where typedef struct node Node; pays off.
5.1.26 Typedef (Hinglish) — same ideas in Hinglish.