Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
gggmork

acs array as function parameter?

Recommended Posts

I guess feeding an array to a function as an argument is a no no?

int myarray[2] = {5,2};
script 1 open{
    while (1){
        printThis(myarray);
    }
}
error says:
missing '['

But if I change the first line to
int myvar = 5;
there's no errors (printThis is a simple test function not shown).

Share this post


Link to post

Aw nuts, thanks for the confirmation.

Edit: actually I'm probably an idiot because arrays have to be global anyway (declared outside of scripts).. so functions can probably access them without needing them as a parameter.

Share this post


Link to post
gggmork said:

Aw nuts, thanks for the confirmation.

Edit: actually I'm probably an idiot because arrays have to be global anyway (declared outside of scripts).. so functions can probably access them without needing them as a parameter.

Probably what you'll have to do then is define constants which indicate which array your function should use and then use a large switch or if/else chain to pick the proper array. Then you can pass the constant to the function instead of the array itself, kinda like a skank version of a hash key or pointer.

Share this post


Link to post

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  
×