•  Back 
  •  C Language 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : C-Language Documentation
Author      : John Kormylo
Version     : C.HYP 1.0
Subject     : Documentation/C-Language
Nodes       : 233
Index Size  : 6362
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : en
@default    : 
@help       : Help
@options    : +g -i -s +x +z -t4
@width      : 75
View Ref-File[ Function Pointers ]

... are variables which store the starting address of a function.
De-referencing a function pointer means executing that function.
Otherwise they are like any other pointer variable.

The most common application for function pointers is as a function
parameter so that one can execute a function (or several different
functions) inside another (older) function (as is done by signal
and Supexec).

Definition Syntax:

 [<class>] [<type>] [<parm>] (* <name>) (<type> <arg name> [, ...] );

where <class> is the storage class of the pointer,
<type> is a data type of the function,
<parm> is either 'cdecl' or 'pascal',
<name> is the pointer name, and
<arg name> is a dummy argument name.

Calling Syntax:

   (* <name>) ( <arg> [, ...] )

where the value of <arg> is passed to the corresponding <arg name>.

Example:

  int (* write_string) (const char *s);

  write_string = puts;
  (* write_string) ("Hello world! \n");