liveBook · Manning

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.

How 2 Manning books explain it

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.

Read how Modern C explains void type →

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.

Read how Systems Programming with Zig explains void type →

Also covered in

What to know first

Related concepts

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.