I am new to C and am confused why the compiler is totally okay with the following code snippet where I am casting the foo function pointer to other function pointers with different arities. This means that a single void * parameter in a function pointer declaration can be cast to any number of parameters? Can some one please help me understand why this is no problem in C?
//
#include <stdio.h>
int main() {
// function pointer declaration
void *(*foo)(void *);
// castings
(int *(*)(int *, int *))foo;
(int *(*)(float *, int *, char **))foo;
(int *(*)(int, int))foo;
return 0;
}