Function pointer

A function pointer, also called a subroutine pointer or procedure pointer, is a pointer referencing executable code, rather than data. Dereferencing the function pointer yields the referenced function, which can be invoked and passed arguments just as in a normal function call. Such an invocation is also known as an "indirect" call, because the function is being invoked indirectly through a variable instead of directly through a fixed identifier or address.

Function pointers allow different code to be executed at runtime. They can also be passed to a function to enable callbacks.

Function pointers are supported by third-generation programming languages (such as PL/I, COBOL, Fortran,[1] dBASE dBL, and C) and object-oriented programming languages (such as C++, C#, and D).[2]

  1. ^ Andrew J. Miller. "Fortran Examples". Retrieved 2013-09-14.
  2. ^ "The Function Pointer Tutorials". logo. Archived from the original on 2011-05-16. Retrieved 2011-04-13. Function Pointers are pointers, i.e. variables, which point to the address of a function

© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search