Question:
I am a beginner to C++ and have looked into several resources but still have some questions. Can you tell me what a void pointer is and what it is used for (implementation)? Also, what is the -&#gt; operator?
Answer:
A void pointer is simply an untyped pointer. That is, a pointer to an unspecified type of variable. Void pointers are usually used where it is not known in advance what data type a pointer will point to.
For example, malloc returns a void pointer because malloc does not know how the allocated memory will be used. Since pointers all use the same amount of memory, a void pointer can be converted to any other type of pointer and, normally, your code will need to type cast a void pointer to a typed pointer before you can use it.