answersLogoWhite

0

In order to provide modulo (%) facilities as far as mathematics and logic is concern.

for instance , if we have no of employees in our list say 1545 and if we want to accommodate it within small and effective range then by using % we can do it easily....

we can arrange it in the range within Array with maximum index 14 (0,1,2,.....14).

And 0,15,30,45......1545 will belongs to same category say index no 0.

Think if 0 is not included into index then where we would store 0,15,30,45....1530,1545 .

From a technical standpoint, you need to understand that an array is basically just the starting address of a chunk of memory. The "index" of the array is actually an address offset. So the value at the 0th position would be stored at the address of the array plus zero. The value at the 1st position would be stored at the address plus one, and so on.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What is the upper bound of an array whose size is 100?

The upper bound is the size minus 1 since VB starts with zero not one.


How do you obtain a single value from array?

That depends on the language you use, but I guess you're using C. So, here goes: int x[10] = {0}; //declare an array with ten indexes (0 thru to 9) printf("%i\n", x[0]); //print x[0], which should be zero.


Why array index always starts with zero?

Because that's how the language is defined. In C, C++, and many other languages, array indecies start with zero. This is by convention, and it also reflects the fact that, in C and C++, array-index syntax can also be expressed in pointer-offset syntax. The pointer locates the first element of the array, and the offset indicates how many elements to skip. If a is an array name, then the expression a[n] is completely identical to the expression *(a+n), and vice versa.


Index of an element in array?

An array is a group of related elements, with a common variable name. The index is a number that indicates the position of an element within an array: the 1st. element, the 2nd. element, etc. (many languages start counting at zero).


How do you start array list from 1?

Array indices are zero-based because the first element is at offset zero from the start of the array. There is no such thing as a one-based array in C. Some other languages do allow you to specify the base of an array, but converting a non-zero-based index to a zero-based index adds a runtime overhead to the implementation.


How do you read data from array?

Use the array suffix operator [] to access the individual elements of an array through a zero-based index.


What do array subscripts always have?

Array subscripts always have a zero-based index. In languages that allow an n-based index, the index is simply offset by n elements, so the compiler subtracts n from the given index to obtain the zero-based index. Arrays are always zero-based because the first element of an array is found zero elements from the start of the array.


Why numeric arrays do not end with a '0' in C programming language?

The value zero is a perfectly valid numeric array element in its own right. If we used the value zero to mark the end of a numeric array in the same way we use a null-terminator to mark the end of a string (a character array), we'd have no way of representing the value zero within the array itself. Thus when working with numeric arrays, we must keep track of the array length independently of the array.


Why the array is starting from zero?

By design; it makes the compiler's work easier. 1-based array's addressing-function: Address (array, index) = Address (array) + (index-1)*Elemsize(array) 0-based array's addressing-function: Address (array, index) = Address (array) + index*Elemsize (array)


Why array indexes starts from zero in c language?

An array is a pointer to a collection of memory locations in consecutive order, and an array's first element starts at the index's memory location. You can thus visualize it like this: ptr = (0x12345). ptr+0 = (0x12345). ptr[0] = (0x12345). ptr+1 = (0x12346). ptr[1] = (0x12346). This is technically a byte-based example, but the principle holds true regardless of data size if you assume all elements are byte aligned with the data element's size; you can then consider yourself to be accessing the "xth" element of a linear array of memory that is a number of units long (the total memory available to the program). Some languages start with "1" as the first index. Those languages either "waste" the 0th index as a matter of convenience, or silently adjust the index you access by one to match hardware expectations of indexing (e.g. the 10th index is the 11th physical array index).


What are sparse matrixes?

A sparse matrix is an array with more zero values than non-zero values.


What is an Array and to use Array in Action script?

Array is a ranged variable, using it is required by many actions.. like where you going to processing data from a file where there is n lines in a file and you want to get one line of it.. ex: if variable $line is an array of lines in a text file: $line[1] is second line of the file... just keep it in mind arrays starts from zero :) it means line 1 of the file will be accessed with $line[0];