is the array literal in a loop stack or heap allocated?

mw mw at g.c
Wed Oct 11 02:54:53 UTC 2023


Hi,

I want to confirm: in the following loop, is the array literal 
`a` vs. `b` stack or heap allocated? and how many times?

void main() {

int[2] a;
int[] b;

int i;
While(++i <=100) {

   a = [i, i+1];  // array literal
   b = [i, i+1];

}

}


Thanks.


More information about the Digitalmars-d-learn mailing list