Void Pointer

Void pointers do not have any data type of their own and can therefore be assigned to point to ANY other data type.

 

Represents just the address of an object but not its data type.

 

CANNOT be dereferenced directly - HAS to be typecast to the data type of the object being pointed to

 

Compile & Run:

value: 12
value: 14.6345
value: 14.6345

 

 

*Note: Unlike C, you cannot implicitly cast from void * in C++. In C++ it must be explicitly cast

 

source

Leave a Reply