Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / functions and arrays

Author
Message
ifman1
23
Years of Service
User Offline
Joined: 3rd Jul 2003
Location:
Posted: 25th Jul 2003 06:31
Is it possible to pass an array into a function as a function parameter? So far I haven't been able to get this to work. I would also like to return an array from a function. If I can't pass and return the array, maybe I can just manipulate or read the array from memory in a function.

In C++ you can use pointers to manipulate an array in a function. Is that somehow possible in DBPro? Perhaps with "Make Memory" or some kind of Memblock command. I haven't gotten to play around with these yet. The make memory sounds like a pointer.

Thanks in Advance
the Ifman
http://mywebpages.comcast.net/ifman1/Logo2.bmp[/img]
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 25th Jul 2003 06:43
Currently you cannot pass arrays however the newsletter mentioned a change in the way data is passed into and out of functions - the next patch apparently will supports passing of UDT's - these are user define types (as in type/endtype).

Considering that arrays defined outside of the function are global it does seem unusual to require an array to be passable, although I can think of perhaps 1 or 2 instances where this might be useable, this is a lot of data to shunt on an otherwise transient command.

Perhaps the next patch will allow passing of arrays too, i'm not sure, you may wish to check the newsletter to be sure.

Pneumatic Dryll
ifman1
23
Years of Service
User Offline
Joined: 3rd Jul 2003
Location:
Posted: 25th Jul 2003 20:00
Well, not exactly what I wanted to hear... but I guess it's an answer. Thanks.

I was hoping to find a way to use a pointer style of code where the array isn't passed into the function, but the function can access and alter the array. Passing arrays into functions costs a lot of time and overhead.

Thanks anyway.

Login to post a reply

Server time is: 2026-07-23 02:36:31
Your offset time is: 2026-07-23 02:36:31