Skip to content

Instantly share code, notes, and snippets.

@mnogu
Created November 27, 2010 17:29
Show Gist options
  • Select an option

  • Save mnogu/718098 to your computer and use it in GitHub Desktop.

Select an option

Save mnogu/718098 to your computer and use it in GitHub Desktop.
#include <stdio.h>
void bar(void)
{
printf("in bar\n");
}
char *foo(int a, void (*func)(void))
{
(*func)();
printf("in foo: %d\n", a);
return "hoge";
}
int main(void)
{
char *(*const x)(int, void(*)(void)) = foo;
printf("in main: %s\n", x(100, bar));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment