#include <stdio.h>intFUNC3 (inti) { returni;}int(*ff (inti)) (intx) {printf ("%d\n", i); returnfunc3;}intMain () {printf ("%d\n", FF (2)(3)); return 0;}
declare a function pointer, and the return value of the function is also a function pointer to go from:http://www.cnblogs.com/super119/archive/2011/03/26/1996145.htmlfunc is a function pointer, the function return value is int, there is no input parameter, then the main program declares a function pointer myfuncpointer, the function pointer represents a function input parameter is an int, the return value is a function pointer, the type is the Func type. So we can assign the FUNC2 function to the Myfuncpointer pointer. Interview's topic is to myfuncpointer the statement of the pointer. */#include<stdio.h>typedefint(*func) ();//declaring a function pointer with a return value of int, without parameters intfunc3 () {printf ("In function 3......\n"); return 0; } //function pointer with a return value of funcFunc Func2 (inta) {printf ("input parameter is:%d\n", a); returnfunc3; } intMain () {//defines a function pointer with a return value of Func, with an int type argument//This is where you assign the address of the function Func2 to MyfuncpointerFunc (*myfuncpointer) (int) =Func2; //defines a variable that returns a Func type and assigns an initial value to itFunc returnvalue = Myfuncpointer (1111); //define a variable with a return value of type int intFunc3_return =returnvalue (); printf ("Func3 return value is:%d\n", Func3_return); return 0; }
In-depth understanding of pointer functions 2