A void pointer is a pointer which can hold address of object of any type. For example:
int ivalue{1};
float fvalue{1.12};
void *ptr{&ivalue};
ptr = &fvalue;When dereferencing a void pointer, we need to static cast it to the specific type of pointer as shown below:
std::cout << *(static_cast<int *>(ptr)) << '\n';
std::cout << *(static_cast<float *>(ptr)) << '\nFurthermore, we can’t perform pointer arithmetic on void pointers because it requires to know the size of type pointer is pointing to increment and decrement the pointer.