Void type
A void type or return designation represents the absence of a meaningful usable value, especially as the result of a function or procedure.
Modern C
The void type is the C type that represents the absence of a value and cannot directly form an object with a usable stored value.
- How it is used
- Uses void to declare functions with no parameters or no return value, and to erase object-pointer type information.
- How deep it goes
- Defines function conventions and void* conversions, then warns against void variables; it does not develop pointer mechanics further.
- Examples
- Uses main, swap_double, fbar, and object-pointer conversions to illustrate void's function and pointer roles.
- What you can do after
- Apply it via C function declarations and object-pointer conversions, while avoiding void variables and unnecessary void* use.
Systems Programming with Zig
Void is a type representing the absence of a return value.
- How it is used
- Marks functions that complete without producing a return value, including program entry points.
- How deep it goes
- Shows void return declarations and contrasts them with value-returning functions, without examining representation or internals.
- Examples
- Uses `main` returning `void` or `!void` and contrasts it with `fibonacci` returning `i32`.
- What you can do after
- Understand when a Zig function may omit a returned value and how void appears in a declaration.
Also covered in
- Modern C, Third Edition
- Essential TypeScript 5, Third Edition
- Functional Programming in C#, Second Edition
- Clean Applications with Hexagonal ArchitectureIn early access (MEAP)
- React in Depth
What to know first
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- command-line argumentA command-line argument is a value or option supplied to a program when it is invoked, providing input or affecting its behavior.
- declarationA declaration is a language construct that introduces a program entity or name and specifies information about it, such as its type or properties.
- inputAn input is information, a value, or an action supplied to a system, program, or computation for processing or to influence its behavior.
Related concepts
- unit typealternative to · A unit type is a type with exactly one value, typically representing the absence of meaningful information and often written as ().
- Eithercontrasts with · Either is a parameterized sum type whose values hold one of two alternatives, often used to represent an error or a successful result.
- functionconfigures · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- prototypeconfigures · A function prototype is a declaration specifying a function’s name, return type, and parameter types without its implementation.
- commandconfigures · A command is an instruction or representation of a requested operation that a system can execute, often with parameters and potentially changing state.
- statementproduces · A statement is a syntactic unit in a programming or query language that expresses an instruction, declaration, or control operation for a processor to execute.
Questions about void type
What is void type?
A void type or return designation represents the absence of a meaningful usable value, especially as the result of a function or procedure.
Which Manning books explain void type?
Modern C and Systems Programming with Zig.
What should I know before learning void type?
Manning books that teach void type usually introduce function, command-line argument, declaration and input first.
What is the difference between void type and unit type?
A void type or return designation represents the absence of a meaningful usable value, especially as the result of a function or procedure. A unit type is a type with exactly one value, typically representing the absence of meaningful information and often written as ().
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.

