Array of void

I've got to make an array of voids, like following :
void * varray[100];
varray[0] = &myProc();
where myProc is any function in my programm. Later i wanna call it by the array like this :
how could i do this ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You just need to cast the pointer to the type approriate for the function call.

details follow.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
First of all, I think it is easiest to work with function pointers if you define a type definition for the pointer (bacause the syntax is ugly and this keeps the uglyness in mostly in one place.)   If you have functions that takes an int as a parameter and return an int, then a pointer type to these functions called "FunPtrTyp" would be declared like

typedef int (*FunPtrTyp)(int);
Now you can convert a void pointer to this type using a cast like

(FunPtrTyp) SomePtr;

For example

int Increment(int i)
   return i + 1;

void *VoidPtr = Increment;

int X = (*(FunPtrTyp) VoidPtr)(5);

(Note that the syntax of the conversion can be simplified a little, but I find this to be clearer than the simpler form.)
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

However, considering the fact that you have a whole table of these, makes me wonder if there isn't a better--more C++--solution to your needs.  That strongly suggests that you might be better of using virtual functions and functors in your design.  Function pointers are unnecessary, and basically a bad idea in C++.  You need them only when you must interface with non--C++ code, like maybe the OS.  If you are working only in C++ (or in COM), then you should reconsider using them.  Virtual functions will give you all the capabilities of function pointers and more and will do so much more safely.

Let me know if you have any questions.
DennisWoodAuthor Commented:
Much thanx for the quick answer, hope you rise up with the points, c u Dennis
rise up?  to where?  I'm the top expert (at least in terms of points) in C++.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.