1

Possible Duplicate:
Casting a function pointer to another type

int primes[] = {11, 5, 3, 7, 19, 13, 2, 17};
int comp(const int*, const int*);
qsort(primes, 8, sizeof(int), (int(*)(const void*, const void*))comp);

Is the cast in the third line legal? Or must comp take const void* arguments and do the cast inside?

Community
  • 1
  • 1
fredoverflow
  • 256,549
  • 94
  • 388
  • 662
  • http://stackoverflow.com/questions/559581/casting-a-function-pointer-to-another-type http://stackoverflow.com/questions/188839/function-pointer-cast-to-different-signature – Igor Sep 20 '11 at 09:38

0 Answers0