How do high level languages [eg: c#, javascript, python....] create arrays

27 views Asked by At

In low level languages you have to give the length of the array upon creation but in high level languages you don't, so how does it work? How does the computer create the array in a manner to prevent memory collisions and what happens if it collides with other memory addresses?

1

There are 1 answers

0
Jakub Dóka On BEST ANSWER

There is wery big difference etween c# and (python, javascript). c# creates arrays al any other static language, it allocates chunk on memory on heap and gives the pointer, length and capacity to you. When it comes to python and js, when you allocate list, it also has size and cap but you can change only size and cap is abstracted, good thing to note also is that py and js always store values as variants (you can sote string ans int in same list), witch means they are on heap as well and list of ints you have is actually list of pointers.