Last active
January 10, 2020 23:53
-
-
Save misterpoloy/4d90b56765ff03ee23e72a4fd559286d to your computer and use it in GitHub Desktop.
Pointer function using callback
This file contains hidden or 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
// https://www.youtube.com/watch?v=LW8Rfh6TzGg&list=PL2_aWCzGMAwLZp6LMUKI3cc7pgGsasm2_&index=5 | |
#include <iostream> | |
void helloWorld() { | |
std::cout << "Hello world" << std::endl; | |
}; | |
void myFunction(void (*callback)()) { | |
callback(); | |
}; | |
int main() { | |
myFunction(helloWorld); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment