Skip to content

Instantly share code, notes, and snippets.

@misterpoloy
Last active January 10, 2020 23:53
Show Gist options
  • Save misterpoloy/4d90b56765ff03ee23e72a4fd559286d to your computer and use it in GitHub Desktop.
Save misterpoloy/4d90b56765ff03ee23e72a4fd559286d to your computer and use it in GitHub Desktop.
Pointer function using callback
// 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