Hero6
It is currently Thu, 28 Mar 2024 08:53

All times are UTC - 8 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri, 22 Aug 2014 23:23 
Offline
Casual Adventurer

Joined: Sat, 26 Jul 2014 22:29
Posts: 15
Hello everyone.

I was trying to find a way to pass an array as a parameter to a function in AGS and it turned out to be an exercise in frustration, so I simply wanted to share that experience with you and hopefully spare someone else.

Lets say you have a function like this:
function boo(int x[]) {
//code goes here
}


If you try to call it like this it will fail with a "Type mismatch: cannot convert int* to int[]" error:
int my_x[10];
boo(my_x);


The correct way to call this is:
int my_x[] = new int[10];
boo(my_x);


Just FYI in case you need it at some point


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Search for:
Jump to:  

cron
Powered by phpBB® Forum Software © phpBB Group