I understand the use of void pointer for malloc implementation.
void* malloc ( size_t size );
Can anyone suggest other reasons or provide
void
pointers should be used any time the contents of a block of data is not important. For example when copying data the contents of a memory area is copied but the format of the data is not important.
For functions that operate on blocks of memory without needing to understand the contents using void
pointers clarifies the design to users so that they know the function does not care for any data format.
Often functions a coded to take a char *
to handle blocks of memory when the function is actually content agnostic.