Guide
// Function pointer: pointer to a function
// Pointer function: the function that returns a pointer.
// Form 1: return type (* function pointer name) (Form parameter table) (C/C ++)
// Form 2: typedef return type (* New function pointer type) (Form parameter table) (C/C ++)
// Form 3: typedef return type (Class Name: * New function pointer type) (Form parameter table) (C ++)
For example:
INT (* p) (); // * P indicates the function pointer variable, which is followed by () indicates that the pointer variable points to a function.
Typedef int (* FP) (); // * the FP after it indicates the new function pointer type defined by typedef, which is followed by a () indicating that the type points to a function
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------
The following are examples,
/* Author: Eric */
# Include <stdio. h>
Typedef int (* FP) (INT, INT );
Int fuc1 (int I, Int J)
{
Return (I + J );
}
Int fuc2 (int I, Int J, FP P)
{
Return P (I, j );
}
Void main ()
{
Fp p = fuc1;
Printf ("% d", fuc2 (100,200, p ));
}
Tested on VC, Dev C ++, And Turbo C