The return value of a function pointer is an array of pointers, where the return value of an int function pointer is an array of pointers, and an int pointer is placed in the array.
#include <stdio.h>#include <stdlib.h>voidFunintA) {printf ("fun:%d\ n", a);}voidFUN1 (void(*f) (int),intA) {f (a);}intGunintA) {printf ("gun:%d\ n", a);}intGUN1 (intAint(*f) (int) {printf ("gun1:%d\ n", a);}int(*hun (inta)) []{int(*p) [3] = (int(*) [3]) malloc (sizeof(int[3]) *2); (*p) [0] = a+1;//p[0][0] = a+1;p[0][1] = a+2; p[0][2] = a+3; (* (P+1))[0] = a+11;//The following notation is wrong, p+1 must be in parentheses on both sides //(*P+1) [0] = a+11;p[1][1] = a+22; (* (P+1))[2] = a+33;returnP;}int* (*HUN1 (inta)) []{int* (*P) [3] = (int*(*)[3]) malloc (sizeof(int*[3]) *2);int*W1 = (int*) malloc (sizeof(int)); *W1 =Ten+a;int*W2 = (int*) malloc (sizeof(int)); *W2 = -+a;int*W3 = (int*) malloc (sizeof(int)); *W3 = -+a;int*W4 = (int*) malloc (sizeof(int)); *W4 = ++a;int*W5 = (int*) malloc (sizeof(int)); *W5 = -+a;int*W6 = (int*) malloc (sizeof(int)); *W6 = -+a; (*p) [0] = W1; p[0][1] = W2; p[0][2] = W3; (* (P+1))[0] = W4; p[1][1] = W5; (* (P+1))[2] = W6;returnP;}intMain () {//pointer array, with function pointers in the array, pointers to functions with no return value, 1 int parameters void(*a[1])(int); a[0] = &fun; (*a[0])(1);//pointer array, where the function pointer is in the array, the function that points to does not return a value, 2 parameters. The first argument is a function pointer, the function that points to does not have a return value, 1 int arguments, and the second argument is an int void(*b[1])(void(*) (int),int); b[0] = &fun1; (*b[0]) (a[0],Ten);//pointer array, the function pointer in the array, the return value of the function pointed to is int,1 int parameter int(*c[1])(int); c[0] = &gun; (*c[0])(3);//pointer array, the function pointer in the array, the return value of the function pointed to is int,2 parameters. The first argument is int, the second argument is a function pointer, and the return value of the function that points to is int,1 int parameter. int(*d[1])(int,int(*) (int)); d[0] = &gun1; (*d[0])( -, c[0]);//pointer array, the function pointer in the array, the return value of the function pointed to is the array pointer, the array is int,1 int parameter. int(* (*e[1])(int))[]; e[0] = &hun;int(*p) [3] = (*e[0])(3); for(inti =0; I <2; ++i) { for(intj =0; J <3; ++J) {printf ("%d", P[i][j]); } printf ("\ n"); } free (p);//pointer array, in the array is a function pointer, the return value of the function point is an array pointer, the array is an int pointer, 1 int parameters. int* (* (*g[1])(int))[]; g[0] = &hun1;int* (*P1) [3] = (*g[0])(Ten); for(inti =0; I <2; ++i) { for(intj =0; J <3; ++J) {printf ("%d", *p1[i][j]); } printf ("\ n"); } free (p1);}
The return value of the function pointer is an array of pointers, an int is placed in the array, the return value of the function pointer is an array of pointers, and an int pointer is placed in the array.