#include <iostream>
/**
* Callback function need two function:
* 1. caller function - display();
* 2. called function - hello();
*
* Caller function just a function that has task
/**
* Callback function need two function:
* 1. caller function - display();
* 2. called function - hello();
*
* Caller function just a function that has task
* to call the another function
* while the called function is what
* while the called function is what
* the function we define and we write.
*/
using namespace std;
void hello(){
int i=3;
cout << i << endl;
}
void display(void(*func)(void)){
func();
}
int main(int argc, char *argv[]){
display(hello);
}
*/
using namespace std;
void hello(){
int i=3;
cout << i << endl;
}
void display(void(*func)(void)){
func();
}
int main(int argc, char *argv[]){
display(hello);
}
No comments:
Post a Comment