#include<stdio.h>
// typedef int** (*pFunc)(void); 可以定义函数指针类型,也可以直接用
int** Malloc() {
int* *p = new int*;
int* q = new int[10];
*p = q;
for (int i = 0; i < 10; i++)
(*p)[i] = i;
return p;
}
// void Print(pFunc Malloc) { // 对应函数指针类型的函数头
void Print(int** (*Malloc)()) {
int* *p = (*Malloc)();
for (int i = 0; i < 10; i++) {
printf("%d ", (*p)[i]);
}
puts("");
delete *p;
delete p;
}
int main() {
Print(Malloc);
return 0;
}