Last active
October 10, 2015 10:03
-
-
Save soachishti/d521208e9191a6b9cfd9 to your computer and use it in GitHub Desktop.
Callback C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: http://en.wikipedia.org/wiki/Callback_(computer_programming) | |
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
void callback(int (*f)(int i , int b)) { | |
f(10,20); | |
//cout << f(10,20); | |
} | |
int meaningOfLife(int i , int b) { | |
cout << "Hello" << "This is me12321"; | |
cout << i << b; | |
return 42; | |
} | |
int main(void) { | |
callback(&meaningOfLife); | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment