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.
Related concepts
- type aliasproduces · A type alias is a declaration that gives an existing type an alternative name without creating a distinct type or representation.
- 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 or relationship that identifies or provides access to another value, object, resource, or source.
- structuses · A struct is a composite data type or structure that groups related fields or values into a single unit.
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.

