Created
February 12, 2019 03:50
-
-
Save devendranaga/4d8329c804c70a9f05b1c8cad6e4f7e8 to your computer and use it in GitHub Desktop.
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
// callback declaration | |
void (*callback)(int); | |
void print_func(int a) | |
{ | |
printf("%d\n", a); | |
} | |
int register_print_callback() | |
{ | |
callback = print_func; | |
// ... | |
return 0; | |
} | |
// .. down the line in the code.. | |
int d = 3; | |
register_callback(); | |
if (callback) | |
callback(d); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment