Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#include <stdio.h>
int (*p[2]) (int x);
int printInt(int a)
{
printf("%d\n", a);
(*p[a / 1000]) (++a);
return a;
}
int doNothing(int a)
{
return a;
}
main()
{
p[0] = printInt;
p[1] = doNothing;
(*p[0]) (0);
return 0;
}

n4kz commented Sep 6, 2012

That's the right solution =)

Facebook video profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment