void my_func(int sign_no) { if(sign_no==SIGINT) printf("I have get SIGINT\n"); else if(sign_no==SIGQUIT) printf("I have get SIGQUIT\n"); } int main() { printf("Waiting for signal SIGINT or SIGQUIT \n ");
#include <stdio.h>
int add(int a, int b)
{
return a + b;
}
int sub(int a, int b)
{
return a - b;
}
int (*calc)(int a, int b);
typedef int (*Func)(int a, int b);
int main(void)
{
int a = 3, b = 4;
Func fc;
calc = add;
printf("%d\n", calc(a, b));
fc = sub;
printf("%d\n", fc(a,b));
return 0;
}
------解决方案--------------------