Here is my attempt on answering this through a video: https://youtu.be/2yY7Q7ERqFw
Here is the TL;DR version if you do not want to watch a video:
An array is stored in a contiguous space of memory. The address of the first element is the address of the array and subsequent elements are indexed summing an offset to the address of the array. Therefore the offset of the first element is 0.
I would highly recommend watching the video as there are a few more interesting parts to this. Also, do subscribe to my channel if you liked the content :)
Cheers!
Top comments (0)