Jump to content
Sign in to follow this  
ophelius

Function Address

Recommended Posts

Hi,

Is it possible to store the address of a function so I can call it based on a variable? For example, let's say I have 3 functions, a(), b(), and c(), and the program needs to call one of those based on a variable x. So first i would allocate an array F[3] and store the addresses of all 3 functions like this: F[0] = @a(), F[1] = @b(), F[2] = @c() and now I can simply do this: call F[x]. And if x = 0, the a() would be called, etc.

I'm aware that I can do: If x = 0, then call a(), etc, but that's not what I need. Thanks

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...