Void functions, also called nonvalue-returning functions, are used just like value-returning functions except void return types do not return a value when the function is executed. The void function accomplishes its task and then returns control to the caller. The void function call is a stand-alone statement.
A void pointer is a pointer that has no associated data type with it. A void pointer can hold address of any type and can be typecasted to any type.
A void pointer can point to a variable of any data type. Here is the syntax of void pointer. Here vp is a void pointer, so you can assign the address of any type of variable to it. A void pointer can point to a variable of any data type and void pointer can be assigned to a pointer of any type.
While following some tutorials and reading about function pointers I learned that evidently assigning a void pointer to a function pointer in ISO C is undefined, is there any way to resolve the warning I receive during compile time (e.g. a better way of coding it) or should I just ignore it?
Warning:
ISO C forbids assignment between function pointer and 'void *' [-pedantic]
Example Code:
void *(*funcPtr)(); funcPtr = GetPointer();
GetPointer is a function that returns a void pointer E.G.
void *GetPointer();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With