How a Computer handles operations on an Array?

Updated: Jul 10

When we declare an array using any programming language, what actually happens behind the scenes, how an array works, what is the interaction of the array with the memory, blah blah blah. Ah, Don't Panic, Prashant will make it easy.


Let's take an example array:


friendsOfPrashant = ['Sachin', 'Rohit', 'Tinkal']


Now, what we have is, an array friendsOfPrashant, and 3 elements inside the array: 'Sachin', 'Rohit', & 'Tinkal' & we know the count of the elements in an array starts with 0.


What will happen when we'll create this array in our code of any language?


It will first allocate a contiguous set of empty cells for use in the program. Every cell in computer memory has a specific address (It's like House No.). Each cell's memory address is one number greater than the previous cell's address.


It will create an array to hold 3 elements ('Sachin', 'Rohit', 'Tinkal')



Related Posts

See All

If you're an aspiring Software Engineer or Software Development Engineer, I've curated repositories categorically for independent topics required to boost yourself in this journey of becoming a Softwa

Subscribe

Thanks for submitting!