3 ms·
It depends on whether you are using the array start as a pointer to a RAM address or as an arbitrary number. Both ways are valid. Lower-level languages like C
by simonblack 4y ago
It depends on whether you are using the array start as a pointer to a RAM address or as an arbitrary number.
Both ways are valid. Lower-level languages like C start their index from zero, Other higher-level languages like (IIRC) COBOL start their indexes from one.
Zero-indexed arrays usually have their pointer begin at the address of the start of the array, so
first element is at array-start (array+0) = array[0]
second element is at array-start+1 (array+1) = array[1]
third element is at array-start+2 (array+2) = array[2]
and so forth.