A pointer function is a function that returns a pointer type to a function.
A function pointer is a pointer to a function address to a pointer.
The key to distinguishing between the two is whether the function name is surrounded by a * and parentheses .
1#include <stdio.h>2 int*create_node (int);//pointer function declaration3 int*(*fun)(int);//A function pointer declaration that points to a function that returns int* and has an int parameter.4 5 //defines a pointer function (a function that returns a pointer to a value)6 int*create_node (intval) {7 int*a =New int;8*a =Val;9 returnA;Ten } One A intMain () { - //Functions are called by function name, which is the function's pointer - //function name point is function to address the int*a = Create_node (4); -printf"a_val:%d\n", *a); - DeleteA; - + //A function pointer is a pointer variable -Fun =Create_node; + int*b = Fun (5); Aprintf"b_val:%d\n", *b); at Deleteb; - - return 0; -}
Just go here and see the code comment. ^_^
C + + pointer functions and function pointers