1 #include<stdio.h> 2 char *fun1(char *p) 3 { 4 printf("%s\n", p); 5 return p; 6 } 7 char *fun2(char *p) 8 { 9 printf("%s\n", p); 10 return p; 11 } 12 char *fun3(char *p) 13 { 14 printf("%s\n", p); 15 return p; 16 } 17 18 int main(int argc, const char *argv[]) 19 { 20 char *(*pf[3])(char *P);//定义一个函数指针数组 21 pf[0] = fun1;//给数组元素赋初值 22 pf[1] = fun2; 23 pf[2] = fun3; 24 pf[0]("shen"); 25 pf[1]("shen"); 26 27 return 0; 28 }