liveBook · Manning

Void pointer

A void pointer is a C pointer of type void* that can hold the address of an object without specifying its pointed-to object type.

How 2 Manning books explain it

Modern C, Third Edition

A void pointer is a C pointer to void that can hold the address of an object of any object type, subject to valid conversions and qualification rules.

How it is used
Supports generic data interfaces such as qsort and bsearch while leaving type recovery and safety to the caller.
How deep it goes
Explains conversions, identity preservation, qualification, and generic-interface hazards, but stops short of detailed implementation internals.
Examples
Uses qsort and bsearch signatures, an unsigned comparator, and invalid integer subtraction to expose generic-interface constraints.
What you can do after
Apply it via qsort or bsearch while matching element types, qualifications, sizes, and comparator behavior.

Read how Modern C, Third Edition explains void pointer →

Modern C

A void pointer is a C pointer value of type void* that can hold the address of an object without retaining its pointed-to type information.

How it is used
Uses void* to abstract object types and make dynamic-allocation interfaces applicable to many object types.
How deep it goes
Defines conversion guarantees, storage abstraction, allocation behavior, and avoidance guidance, but does not develop implementation internals.
Examples
Demonstrates a double vector allocated with malloc and sized using sizeof *largeVec.
What you can do after
Apply void* through malloc and free while preserving correct object-pointer conversions and allocation sizes.

Read how Modern C explains void pointer →

Related concepts

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.