All void means is "no type".
So this:
where func is:
will never work because func is "no type". Therefore no value can be assigned to var.
You see, when you call a function it becomes an instance of its return type so
tells the compiler that if func() is called it will result in an int which can be assigned to var. So this is safe:
but
means that func will result in "no type" so an assignment to var is invalid.
Then there's
where func can take an argument of anything and the function will work. In C functions must have unique names. If arg can be a pointer to a double or an int you can't have:
- int func(int* arg);
-
double func(double* arg);
You would need:
- int func-int(int* arg);
-
double func-double(double* arg);
If there were 30 types func needs to handle you would need 30 functions. So this is the usual solution:
- int func(void* arg, unsigned int argtype);
The argtype can be used inside the function to typecast arg to the correct type. Now you need only one function.