On 21.04.22 07:49, Alain De Vos wrote:
int *p=null; void myfun(){ int x=2; p=&x; writeln(p); writeln(x); } myfun(); *p=16; writeln(p); writeln(*p);
`p` is no longer valid after `myfun` returns. Dereferencing it is an error.The two `writeln` calls in `main` re-use the memory that `p` points to for their own purposes.