Assuming you want to call through an array of functions looking for one of those functions to return 1:
Notice that all function signatures must be identical for this technique to work - in this case they all return int and accept void.
For more examples: How can I use an array of function pointers?
int fun1 ()
{
// Place the condition you want to check here - might make more sense to pass it in as a parameter to all functions...
if (/*condition*/ 1)
{
return 1;
}
else
{
return 0;
}
}
// Assuming this functions would do something more useful in your case - PH so it compiles.
int fun2 () {return 0;}
int fun3 () {return 0;}
int main(void)
{
int (*func_ptr[3])() = {fun1, fun2, fun3}; //all 3 functions in array
// Loop through all functions - note we should use a sizeof() trick on the func_ptr array to be more correct on array size.
for(int i=0; i<3; i++)
{
// Call each function and check for "1"
if((*func_ptr[i])() == 1)
{
// If "1", do something
}
}
return 0;
}