GNU Readline Library. Node: The Function Type

prev UPCustom Functions NEXTFunction Writing

2.2.1: The Function Type

For readabilty, we declare a new type of object, called Function. A Function is a C function which returns an int. The type declaration for Function is:

typedef int Function ();

The reason for declaring this new type is to make it easier to write code describing pointers to C functions. Let us say we had a variable called func which was a pointer to a function. Instead of the classic C declaration

int (*)()func;

we may write

Function *func;

Similarly, there are

typedef void VFunction ();
typedef char *CPFunction (); and
typedef char **CPPFunction ();

for functions returning no value, pointer to char, and pointer to pointer to char, respectively.

prev UPCustom Functions NEXTFunction Writing