3 ms·
> However, given how low-level a language C++ is, we can actually break this assumption by setting i to y-x. Since &x[i] is the same as x+i, this means we are a
by vardump 8y ago
> However, given how low-level a language C++ is, we can actually break this assumption by setting i to y-x. Since &x[i] is the same as x+i, this means we are actually writing 23 to &y[0].
> This assumes that the address space of y starts at the end of the address space of x?
No it does not. Any value of x or y should "work", because y-x computes a difference between pointers.
> Could these two allocated blocks of memory ever not be continuous?
Probability they're not continuous is high and only gets higher as the heap gets more fragmented over time.