typedef void int_void(int);
int_void is a function taking an integer and returning nothing.
My question is: can it be
This should work, no casting required:
void f(int x) { printf("%d\n", x); }
int main(int argc, const char ** argv)
{
typedef void (*int_void)(int);
int_void test = f;
...
}
A function's name "devolves" into a function pointer anytime you use the function's name in something other than a function call. If is is being assigned to a func ptr of the same type, you don't need a cast.
The original
typedef int_void(int);
is not useful by itself, without using a pointer to the type. So the answer to your question is "no, you can't use that typedef without a pointer".