I’m working with C, but I think this is a more low level question that isn’t language specific.
How does the program correctly grab the right data with array[0] or array[6] regardless of what type of data it holds? Does it store the length internally or have some sort of delimiter to look for?
the compiler knows the
sizeofthe underlying datatype and adds the right byte offset to the pointer.a[10]is equivalent to*(a + 10)which is equivalent to*(10 + a)which in turn is equivalent to10[a], no kidding.