Advertisement

Calling functions through pointers

Started by June 02, 2002 04:51 PM
2 comments, last by Arek the Absolute 22 years, 6 months ago
I can''t seem to find out if there''s a way to do this... If I have a whole bunch of functions that all follow this prototype: void FunctionName(void); and I keep a pointer to one of these functions, can I use that pointer to call the function...? -Arek the Absolute
-Arek the Absolute"The full quartet is pirates, ninjas, zombies, and robots. Create a game which involves all four, and you risk being blinded by the sheer level of coolness involved." - Superpig
typedef void (*fnptr)(void);

fnptr fn1 = &FunctionName
or
fnptr fn1 = FunctionName;

(*fn1)();
or
fn1();
---visit #directxdev on afternet <- not just for directx, despite the name
Advertisement
Click here for more than you ever wanted to know about function pointers
Thanks a million, IndirectX.
You too, invective.

-Arek the Absolute
-Arek the Absolute"The full quartet is pirates, ninjas, zombies, and robots. Create a game which involves all four, and you risk being blinded by the sheer level of coolness involved." - Superpig

This topic is closed to new replies.

Advertisement