/*用函数指针高效的完成switch case的功能*/
#include
void *f1(){//定义指针函数 printf("hellow world 1\n");}
void *f2(){ printf("hellow world 2\n");}
void *f3(){ printf("hellow world 3\n");}
void *f4(){ printf("hellow world 4\n");}
void *f5(){ printf("hellow world 5\n");}
int main()
{
void *(*a[])()={f1,f2,f3,f4,f5};//函数名是这个函数的地址,定义一个指针函数数组存储函数的地址;
int n; while(scanf("%d",&n)!=EOF && n<=5)
a[n-1]();//调用函数
return 0;
}