To use function pointers it is first necessary to define the function signature that will be used at the global scope. Once that is done the variables can be declared using that definition.
Here's an example that shows the syntax for using function pointes:
// Define a function signature for the function pointer funcdef bool CALLBACK(int, int);
// An example function that to use this void main() { // Declare a function pointer, and set it // to point to the myCompare function. CALLBACK @func = @myCompare;
// The function pointer can be compared with the 'is' operator if( func is null ) { print("The function pointer is null\n"); return; }
// Call the function through the pointer, just as if it was a normal function if( func(1, 2) ) { print("The function returned true\n"); } else { print("The function returned false\n"); } }
// This function matches the CALLBACK definition, since it has // the same return type and parameter types. bool myCompare(int a, int b) { return a > b; }