answersLogoWhite

0


Best Answer

(array.length - 1) will find the index of the last element in an array (or -1 if the array is empty).

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the index number of the last element of an array with 9 elements?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you declare an array on Pascal?

type array-identifier = array[index-type] of element-type; array-identifier : the name of your array index-type : any scaler except real element-type : the type of element The index type defines the range of indices and thus the number of elements to allocate. For example, [0..41] will allocate 42 elements indexed from 0 to 41, thus creating a zero-based array. If you require a one-based array, use [1..42] instead. Regardless of the range of indices, the first element is always at the lowest address of the array (the compiler will convert your index range into a zero-based range automatically). The element-type determines the length of each element in the array. Multiplying the element length by the number of elements gives the total amount of memory allocated to the array.


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).


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 the index of an array be a positive number?

Since an array cannot contain a negative number of items, the size of an array must be at least 0. So if you ever tried to retrieve the element at a negative index in an array, it would automatically be understood to be out-of-bounds.


What is an element in the Array?

An array is a container object that holds a fixed number of values of a single type. ... Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.

Related questions

Why in c plus plus index always start with 0?

C++ array indices are zero-based because the first element in any array is offset 0 elements from the start address. The second element is offset by 1 element and the third by 2 elements, and so on. To put it another way, the index refers to the number of elements that come before the desired element. The first element has zero elements before it, so it is index 0. For an array of n elements, the last element is at index n-1.


How do you declare an array on Pascal?

type array-identifier = array[index-type] of element-type; array-identifier : the name of your array index-type : any scaler except real element-type : the type of element The index type defines the range of indices and thus the number of elements to allocate. For example, [0..41] will allocate 42 elements indexed from 0 to 41, thus creating a zero-based array. If you require a one-based array, use [1..42] instead. Regardless of the range of indices, the first element is always at the lowest address of the array (the compiler will convert your index range into a zero-based range automatically). The element-type determines the length of each element in the array. Multiplying the element length by the number of elements gives the total amount of memory allocated to the array.


What is the Program to find the largest element in an array and position occurrence?

#include<stdio.h> #include<conio.h> main() { int a[100]; int n,largest,index,position; printf("enter the number of elements in the array"); scanf("%d",&n); printf("enter %d elements",n); for(index=0;index<n;index++) scanf("%d",&a[index]); largest=a[0]; position=0; for(index=1;index<n;index++) if(a[index]>largest) { largest=a[index]; position=index; } printf("largest element in the array is %d\n",largest); printf("largets element's position in the array is %d\n",position+1); getch(); }


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).


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 the index of an array be a positive number?

Since an array cannot contain a negative number of items, the size of an array must be at least 0. So if you ever tried to retrieve the element at a negative index in an array, it would automatically be understood to be out-of-bounds.


How do you find particular element in array?

by using index position we can find the particular element in array.


What is an element in the Array?

An array is a container object that holds a fixed number of values of a single type. ... Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.


When can you use index numbers?

When you are accessing an array's element.


What are index numbers used for?

Identifying array-elements.


How will you find the location of an element of an array?

Basically, &array[i]; That is, the memory location for an array object with index i. Or, you can do: (array + i);


C plus plus program for linear search non-recursive method?

#include#include#includevoid main(){int arr[100],i,element,no;clrscr();printf("\nEnter the no of Elements: ");scanf("%d", &no);for(i=0;i