Typedef
typedef is a C and C++ declaration mechanism that introduces an alternative name for an existing type.
Modern C, Third Edition
A typedef is a C declaration that introduces an alias for an existing type.
- How it is used
- Uses aliases to simplify structure names, represent semantic types, and make multidimensional array declarations more readable.
- How deep it goes
- Explains aliasing, structure forward declarations, arrays, reserved names, and semantic typedefs, without descending into compiler implementation.
- Examples
- Demonstrates structure aliases, array aliases, multidimensional arrays, and implementation-provided names including size_t and ptrdiff_t.
- What you can do after
- Apply typedef to name existing structure, array, and implementation-provided types while preserving type identity and naming constraints.
Modern C
A typedef is a C declaration that introduces an alias for an existing type.
- How it is used
- Simplifies repeated type declarations, especially structure names and interfaces.
- How deep it goes
- Defines alias semantics and demonstrates structures, arrays, forward declarations, and pointer-visibility tradeoffs.
- Examples
- Uses same-name structure aliases, opaque structure interfaces, and nested array aliases as concrete declaration patterns.
- What you can do after
- Apply it to shorten declarations while preserving the underlying type and keeping important pointer syntax visible.
Also covered in
- Embedded Software with RustIn early access (MEAP)
- 100 C++ Mistakes and How to Avoid Them
What to know first
- basic typeA fundamental type used to represent values directly or as the basis for derived and composite types.
- float64Float64 is a 64-bit floating-point numeric type, commonly represented by the IEEE 754 binary64 format.
- structA struct is a named composite type or data structure that groups multiple fields or values into one structured unit.
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
Related concepts
- type aliasproduces · A type alias is a declaration that gives a type or type expression an alternative name without introducing a distinct nominal type.
- atomic typeproduces · An atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.
- using keywordalternative to · The C++ using keyword introduces a name into scope or defines an alias for a type or other declaration.
- referencecontrasts with · A reference is an indirect value, binding, or relationship that identifies or provides access to another object, value, resource, or source.
- structuses · A struct is a named composite type or data structure that groups multiple fields or values into one structured unit.
Questions about typedef
What is typedef?
typedef is a C and C++ declaration mechanism that introduces an alternative name for an existing type.
Which Manning books explain typedef?
Modern C, Third Edition and Modern C.
What should I know before learning typedef?
Manning books that teach typedef usually introduce basic type, float64, struct and array first.
What is the difference between typedef and using keyword?
typedef is a C and C++ declaration mechanism that introduces an alternative name for an existing type. The C++ using keyword introduces a name into scope or defines an alias for a type or other declaration.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

