#include <iostream>
using namespace std;
int fun(int *)
{
cout<<"Hello World";
return 0;
}
int main()
{
// int(*(*func)[5])(int *); this int (* (*)[5])(int*)类型
// int(*)(int *)
// (*func)[5]
typedef int(*ptr_fun)(int *);
typedef ptr_fun ptr_arr[5];
typedef int(*(*func)[5])(int *);
ptr_arr ptr = {&fun,fun,fun,fun,fun};
func func_ptr = &ptr;
for (int i = 0; i < 5; ++i)
{
(*(*func_ptr + i))(NULL);
cout<<endl;
}
// int (*(*func1)(int*))[5]; int (* (*)(int*))[5] 类型
// 指向返回值是int (*)[5]型、参数为int*型的函数
typedef int (*arr_return)[5];
typedef arr_return (*final)(int *);
typedef int (*(*func1)(int*))[5];
func1 tom;
tom = (final)tom; //可以强制类型转化
return 0;
}
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交