Sign in to follow this  
scratt

Conditionally calling function via pointer?

Recommended Posts

If I have a function pointed to by void (*foo)(void) and I want to only call it if it's not pointing to NULL how would I go about it? i.e. if(foo) foo(); Obviously the above does not work, but I can't find an example of how to wrangle it to work. Thanks for any help. Scratch that.. if(foo) foo(); appears to work. I was trying if(foo())foo();

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this