So in a language like C, memory is separated into 5 different parts: OS Kernel, text segment, static memory, dynamic memory, and the stack. Something like this:
You are creating a new array, not modifying the old one. The new array will get its own space and the old one will be garbage-collected (so long as nobody else holds a reference to it).