Squaring Arrays without Overlapping Array Error

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 7 01:10:33 PDT 2015


On Tuesday, 7 July 2015 at 08:06:50 UTC, tcak wrote:
> On Tuesday, 7 July 2015 at 05:27:10 UTC, jmh530 wrote:
>> [...]
>
> I have never used arrays in that way before, though I don't get 
> why you are writing return line in that way. Shouldn't it be 
> like `return (x[] * x[]);` ?

But, yes, the result should be stored somewhere still. Since 
either you, or the compiler would be writing a loop for 
multiplication already, I would be writing by hand for this 
operation.


More information about the Digitalmars-d-learn mailing list