Function Pointer and callback in C plus plus programming language. The following code shows the use of function pointer and callbacks in C plus plus Programming Language.
Code:
#include<iostream>
using namespace std;
void A()
{
cout << "Hello";
}
void B(void (*ptr)())
{
ptr();
}
int main()
{
B(A);
return 0;
}
Output:
Hello