ILE C/C++ Programmer's Guide

Declaring a Function Pointer to a Bound Procedure in ILE C

A function pointer is a pointer that points to either a bound procedure (function) within an ILE program object, or an OS-linkage program object (system pointer) in the system.

Figure 190 shows you how to declare a pointer to a bound procedure (a function that is defined within the same ILE program object):

Figure 190. ILE C Source to Declare a Pointer to a Bound Procedure




int fct1( void ) {....}
int fct2( void ) {....}
int (*fct_ptr)(void) = fct1;
int main()
{
fct_ptr(); /* Call fct1() using fct_ptr. */
fct_ptr = fct2; /* Dynamically set fct_ptr to fct2.*/
fct_ptr(); /* Call fct2() using fct_ptr. */
}


[ Top of Page | Previous Page | Next Page | Table of Contents ]