signal函数的原型是啥?
void (*signal (int signo,void (*func)(int) ) ) (int)是什么意思?
typedef void (*FUNC)(int);
typedef FUNC (*SIGNAL)(int, FUNC);
void foo1(int k){printf("foo1 %d\n",k);}
void foo2(int i){printf("foo2 %d\n",i);}
void (*signal (int signo,void (*func)(int) ) ) (int)
{
func(signo);
printf("signal %d %x\n",signo,func);
return foo2;
}
int main(){
SIGNAL signal_function = signal;
signal(10,foo1)(100);
signal_function(11,foo1)(101);
return 0;
}