First of all, you can never give a function pointer a pointer to a function of another type. This behavior is undefined in C (C11 6.5.2.2).
A very important tip when working with function pointers is always to use typedefs.
So your code can / should be rewritten as:
typedef int (*func_t)(int*, int*); int func0(int*,int*); int func1(int*,int*); int main(){ int i = 1; myfunc(34,23, (i==1?func0:func1));
To answer the question, you want to use function pointers as parameters when you do not know the nature of the function. This is common when writing general algorithms.
Take the standard C function bsearch() as an example:
void *bsearch (const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); );
This is a general binary search algorithm that searches for any form of one-dimensional binding containing unknown data types, such as user types. Here, the “compare” function compares two objects of unknown nature for equality, returning a number to indicate this.
"The function must return an integer less than, equal to, or greater than zero if the key object is considered correspondingly smaller to match or be greater than the element of the array."
The function is written by the caller who knows the nature of the data. In computer science, this is called a “function object” or sometimes a “functor”. This is commonly found in object oriented design.
Example (pseudo code):
typedef struct // some user-defined type { int* ptr; int x; int y; } Something_t; int compare_Something_t (const void* p1, const void* p2) { const Something_t* s1 = (const Something_t*)p1; const Something_t* s2 = (const Something_t*)p2; return s1->y - s2->y;