Function Pointer and callback in C plus plus programming language
Author: Al-mamun Sarkar
Date: 2020-04-03 17:35:10
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