Returning Arrays from Functions

Samwise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 18 15:42:02 PST 2017


On Wednesday, 18 January 2017 at 23:09:15 UTC, Adam D. Ruppe 
wrote:
> On Wednesday, 18 January 2017 at 22:51:17 UTC, Samwise wrote:
>> 	numbs[] = getInp(help, file, inp, args);
>
> This is wrong, try just `numbs = getImp(...);`
>
> numbs[] = xxx will copy stuff into the existing array, which is 
> empty right now. You want to jut keep the slice the function 
> passes back.

Huh. I thought I tried that. I guess I didn't, since it worked 
like a charm. Thanks loads.
~Sam


More information about the Digitalmars-d-learn mailing list