There are times when the type of a pointer is not known. This occurs primarily in C library functions.
For this reason, the void* pointer type represents a generic, as yet unspecified pointer; in other words, a pointer whose type is not known at declaration. Any pointer type can be assigned to a pointer variable of the void* type. However, before that pointer variable can be accessed, the type of the data being accessed must be specified through the use of a casting operation:
void* aPtr = NULL; // we don't yet know what it points to.
...
aPtr = &height; // it has the address of height, but no type yet.
...
int h = (int)*aPtr; // with casting, we can now go to that address
// and fetch an integer value.
In the first statement of the preceding code block, we see how aPtr is declared as a pointer but we don't yet know it's type or what it points to. In the next statement, aPtr is given the...