110-cast-fnptr.c (313B)
1 /* Cast of a function pointer through void* and back. tcc.c does this 2 * to generic-ize callbacks. */ 3 4 int dbl(int x) { return x * 2; } 5 6 int main(int argc, char **argv) { 7 int (*fp)(int) = dbl; 8 void *gp = (void *)fp; 9 int (*fp2)(int) = (int (*)(int))gp; 10 if (fp2(21) != 42) return 1; 11 return 0; 12 }