stack out of scope ?

Alain De Vos devosalain at ymail.com
Sun May 16 16:32:45 UTC 2021


Why doesn't this program dups core ?
Is s not recycled ?
```
import std.stdio:writeln;
void main(){
//I point to the heap
int[] p=[1,2,3];	
	{
		int[3]s=[1,2,3];
		//I point to the stack
		p=s;
	}
	//Why do I still live ?
	writeln(p[0]);
}

```


More information about the Digitalmars-d-learn mailing list