As you can see from my above coding, there are several dangers in passing pre-declared arrays.
As you can also see, the core of the code is quite small, so I would STRONGLY suggest you actually include the code
WITHIN the function that declares the result array and bypass all the serious risks with array passing.
I'll try to get an example posted later today or tomorrow.
Either way, you should also call a str_remove() on each array entry after it is used, or on every entry in the array
before exiting or each un-removed entry will become "leaked" memory.
Best of luck, and feel free to ask questions.
PS EXPERTS - sideline question here, please clarify my understanding here.
If you declare structures and/or array pointers as local variables, and fill them using
creation functions (eg str_create), does the contents of those pointers get purged on the function
closing/terminating or does the contents become "leaked memory" (as I understand is the case).
Does it vary between pointer types or anything if I am wrong?
Thanks