Check out example codes for "Function pointer C++". It will help you in understanding the concepts better.

Code Example 1

void one() { cout << "One\n"; }
void two() { cout << "Two\n"; }


int main()
{
	void (*fptr)(); //Declare a function pointer to voids with no params

	fptr = &one; //fptr -> one
	*fptr(); //=> one()

	fptr = &two; //fptr -> two
	*fptr(); //=> two()

	return 0;
}

Code Example 2

#include <stdio.h> 
// A normal function with an int parameter 
// and void return type 
void foo(int a) { 
    printf("foo: Value of a is %d\n", a); 
}

int add(int a, int b) {
	return a+b;
}

// Take function as argument
void baz(void (*fun)(int), int arg) {
	// call fun
  printf("baz: Calling func pointer with arg %d\n", arg);
  fun(arg);
}

int main() {
  	// Create pointers
  	void (*fun_a)(int) = &foo;
    void (*fun_b)(int) = foo;  // & removed 
  	int (*fun_c)(int, int) = add;
  
    (*fun_a)(10); // If you have the address, use *
  	fun_b(10);    // * removed
  	printf("fun_c(10, 20) = %d\n", fun_c(10,20));
    baz(foo, 10);
  
    // output:
    // foo: Value of a is 10
    // foo: Value of a is 10
    // fun_c(10, 20) = 30
    // baz: Calling func pointer with arg 10
    // foo: Value of a is 10
    return 0; 
}

Learn ReactJs, React Native from akashmittal.com