#include typedef int (*Callback)(void *, int); struct Closure { Callback call; void *env; }; struct Offset { int amount; }; static int add_offset(void *env, int x) { const struct Offset *offset = env; return x + offset->amount; } int main(void) { struct Offset offset = { 7 }; struct Closure closure = { add_offset, &offset }; printf("%d\n", closure.call(closure.env, 5)); return 0; }