Extended Types of Pointers II

This lesson covers the following two types of pointer and their applications:

  • Void pointer

  • Function pointer

The void pointer

In C++, a void pointer is a special pointer type that can hold the address of any type of object but doesn't provide information about the type itself. It is often used when dealing with generic or unknown types. In this part, we explore the syntax and usage of void pointers with a simple example.

A void pointer is declared using the void* type. Its generic syntax is as follows:

Get hands-on with 1200+ tech skills courses.