I understand the use of void pointer for malloc implementation.
void* malloc ( size_t size );
Can anyone suggest other reasons or provide
It is commonly used in numerical code, for example a C root solver function might look like that:
double find_root(double x0, double (*f)(double, void*), void* params)
{
/* stuff */
y = f(x, params);
/* other stuff */
}
params
is cast by f
to some structure it knows about, but find_root
doesn't.