typedef void int_void(int);
int_void
is a function taking an integer and returning nothing.
My question is: can it be
I think it's legal - the following demonstrates its use:
typedef void f(int);
void t( int a ) {
}
int main() {
f * p = t;
p(1); // call t(1)
}
and actually, this C++ code compiles (with g++) & runs - I'm really not sure how kosher it is though.
#include
typedef void f(int);
void t( int a ) {
printf( "val is %d\n", a );
}
int main() {
f & p = t; // note reference not pointer
p(1);
}