C pointers are not necessarily the same size as type int. Pointer arguments given to functions should be explicitly cast to ensure that the correct type expected by the function is being passed. The generic object pointer in C is void*, but there is no generic function pointer.
Any pointer to an object, optionally type-qualified, can be converted to void*, keeping the same const or volatile qualifications.
The allowable assignment conversions involving void* as the left operand are shown in the following table.
Left operand type | Permitted right operand types |
---|---|
(void*) |
|
Pointers to functions cannot be converted to the type void* with a standard conversion: this can be accomplished explicitly, provided that a void* has sufficient bits to hold it.
Related information