Source: https://www.cs.unc.edu/~carterjl/teaching/notes/14_Arrays_Notes.pdf