TITLE: Casting to and from void* PROBLEM: pwang@mcs.kent.edu It is an error to assign a void * type to int * say. But it is O.K to pass a void * argument to an int * formal argument. RESPONSE: steve@taumet.com (Steve Clamage), 3 Oct 92 Argument passing is by initialization rather than assignment, but the rule in question is that of conversion, not assignment versus initialization. Any object pointer may be implicitly converted TO type void*. There is NO implicit conversion FROM type void* to any other type (in C++). Suppose we have these declaration: void *pv; int *pi; void vfoo(void *); void ifoo(int *); This code fragment is valid C and C++: pv = pi; vfoo(pi); This code fragment is illegal C++ (but legal in C): pi = pv; // compile-time error in C++ ifoo(pv); // compile-time error in C++ You can add explicit casts to make the example legal: pi = (int*)pv; ifoo((int*)pv);