ch.3 Algorithms with list of Integers, aka arrays,... array indices start from 0 or 1

lse123

New member
Joined
Nov 12, 2015
Messages
1
Discrete Mathematics and Its Applications Seventh Edition Kenneth H. Rosen

in this book
ch.3 Algorithms with list of Integers, aka arrays,... array indices start from 0 or 1 ? a0 a1 a2 OR a1 a2 a3

I think somewhere refers it but forgot where i saw it...?
 
Discrete Mathematics and Its Applications Seventh Edition Kenneth H. Rosen

in this book
ch.3 Algorithms with list of Integers, aka arrays,... array indices start from 0 or 1 ? a0 a1 a2 OR a1 a2 a3

I think somewhere refers it but forgot where i saw it...?

So look it up.....
 
I can't speak for what that book may or may not tell you... nor do I fully understand your question. What I think you're wanting to know is if array indices begin at 0 or at 1. In computer programming, array indices always start at 0, so referring to the "zeroth" element of an array is something you'll hear. However, it's my understanding that in plain language and mathematics indices typically start at 1, to eliminate the ambiguity present when starting at 0.

In computer programming the standard notation is to use a[X] to refer to the Xth element of the array a. And this is where the ambiguity comes from. It's clear what a[1] means, but to what does the phrase "the second element of the array" refer? Is it, as one would logically expect, the second entry in the array, or a[1]? Or is it what it literally says, the second element, or a[2]?
 
... In computer programming, array indices always start at 0, so referring to the "zeroth" element of an array is something you'll hear. ...
Depends on the language. For example, in FORTRAN the standard was to start indicies at 1 although, as I remember it, in later versions of FORTRAN you could actually start anywhere by defining beginning and ending indicies in the array declaration.
 
Top