C Data Types - Function Pointers

Function Pointers

Function pointers allow referencing functions with a particular signature. For example, to store the address of the standard function abs in the variable my_int_f:

int (*my_int_f)(int) = abs;

Function pointers are invoked by name just like normal function calls. Function pointers are separate from pointers and void pointers.

Read more about this topic:  C Data Types

Other articles related to "function pointers, functions, function, pointers":

Callback (computer Programming) - Implementation
... C, C++ and Pascal allow function pointers as arguments to other functions ... Other languages, such as JavaScript, Lua, Python, Perl and PHP, simply allow the name of a function or a function literal (lambda expression) to be passed through ... encapsulating reference, a 'delegate', to define well-typed function pointers ...
First-class Function - Language Support
... ML, Haskell, F#, and Scala all have first-class functions ... one of the earliest functional languages, was designed not all aspects of first-class function were then properly understood, resulting in functions being dynamically scoped ... dialect, does have lexically scoped first-class functions ...
Dynamic Loading - In C/C++ - Converting Extracted Library Contents - Solving The Function Pointer Problem On POSIX Systems
... The fact remains that any conversion between function and object pointers has to be regarded as an (inherently non-portable) implementation extension, and that no "correct" way for a direct ... issue 6) stated that "a future version may either add a new function to return function pointers, or the current interface may be deprecated in favor of two ... However, the most current version of the standard (issue 7, 2008) simply states that function pointers have to be convertible to void* for POSIX compliance, leaving compiler ...
C++11 - C++ Standard Library Changes - Polymorphic Wrappers For Function Objects
... Polymorphic wrappers for function objects are similar to function pointers in semantics and syntax, but are less tightly bound and can indiscriminately refer to anything which can be called (function ... its characteristics stdfunction func // Wrapper creation using // template class 'function' ... a = func (1, 2) // NOTE if the wrapper 'func' does not refer to any function, // the exception 'stdbad_function_call' is thrown ...

Famous quotes containing the word function:

    Uses are always much broader than functions, and usually far less contentious. The word function carries overtones of purpose and propriety, of concern with why something was developed rather than with how it has actually been found useful. The function of automobiles is to transport people and objects, but they are used for a variety of other purposes—as homes, offices, bedrooms, henhouses, jetties, breakwaters, even offensive weapons.
    Frank Smith (b. 1928)