i wasn't able to do a dynamic array of function pointers, i have troubles understanding how to work with a dynamic array of function pointers when having a pointer to the func_cmp pointer.
int(*func_cmp[])(void *,void*);
numElements++;
func_cmp=(func_cmp*)realloc(func_cmp, numElements*sizeof(func_cmp*));
func_cmp[numElements-1]=*func_cmp;
i'm not sure about the realloc line.
reallocapproach is that calls tomalloc/calloc/reallocare relatively expensive. So creating an initial bock of pointers sufficient to meet your anticipated needs is generally the best approach. Then call realloc, if and only if you need more. It's a tradeoff. If you are on some embedded system with virtually no spare mem, then your realloc-for-each approach may make sense. Otherwise, allocate a sensible number to begin with an then realloc as-needed.