Assuming you are not interested in C++ solutions as suggested, really, why not use a struct instead of an array, if the functions have different return types? This is the customary way to solve this type of problem.
How about this obfuscation example:
Output:Code:#include <iostream> int func1(); double func2(); char func3(int x); typedef void (*voidfunc)(); voidfunc array[3] = { reinterpret_cast<voidfunc>(func1), reinterpret_cast<voidfunc>(func2), reinterpret_cast<voidfunc>(func3) }; int func1() { return 3; } double func2() { return 6.7; } char func3(int x) { return 'a' + static_cast<char>(x); } int main() { std::cout << reinterpret_cast<int (*)(void)>(array[0])() << std::endl; std::cout << reinterpret_cast<double (*)(void)>(array[1])() << std::endl; std::cout << reinterpret_cast<char (*)(int)>(array[2])(6) << std::endl; std::cout << static_cast<int>(reinterpret_cast<char (*)(int)>(array[1])(11)) << std::endl; return 0; }
3
6.7
g
-52
Note that the last line shows how easy it is to make a mistake - it calls a function returning a double with no parameters, but it's got a parameter, and expects a char return.
And if any of my collegues showed me code like this, I would probably throw something hard at him/her.
--
Mats