thanks for replying @salem
I'm looking for an explanation, the first case I can access a previous location in memory.
the second one works if both y and z were int(s).
Also: am just trying to figure out which way does the stack-free store- initially grow.
Both cases trying to access outside the owned memory of the arrays is undefined behavior. You're "lucky" the program seems to run to completion instead of crashing.
am just trying to figure out which way does the stack-free store- initially grow.
Implementation defined. Dynamic arrays created "together" may or may not have their memory in contiguous blocks, or in what order the individual elements are laid out.