answersLogoWhite

0

AllQ&AStudy Guides
Best answer

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

This answer is:
Related answers

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

View page
An array's name implicitly converts to a pointer to the first element of the array at the slightest provocation. Thus to access the first element of the array, the array name suffices. To access any other element in the array without using the suffix operator, use offset pointer arithmetic. For example:
int a[] = {2, 4, 6, 8, 10};
int b;
b = *(a+3);
assert (b == 8);

Here, (a+3) points to the 4th element (offset 3). Dereferencing this address returns the value of that element, in this case 8.
View page

Use the array suffix operator ([]), or use a pointer offset from the start of the array, such that an offset of 1 is equivalent to the size of an array element (all elements in an array must be of equal size). The latter method is what actually goes on behind the scenes when using the array suffix operator, but the former is generally easier to use.

View page

A single dimensional array is an array of items. A two-dimensional array is an array of arrays of items.

View page

An irregular dimensional array is a special type of multi-dimensional array.

First we must understand that a multi-dimensional array is just an array of arrays. Each element in the array is, itself, an array of elements.

A regular multi-dimensional array will be an array of size n, with each element containing a separate array of size m. That is, each sub-array has the same size.

An irregular multi-dimensional array will be a multi-dimensional array in which each sub-array does not contain the same number of elements.

Regular array:
array[0] = new array{0, 1, 2}
array[1] = new array{3, 4, 5}
array[2] = new array{6, 7, 8}
array[3] = new array{9, 10, 11}

This regular array is an array of size 4 in which each sub-array is of size 3.


Irregular array:
array[0] = new array{0, 1, 2}
array[1] = new array{3, 4}
array[2] = new array{5, 6, 7}
array[3] = new array{8, 9, 10, 11}

This irregular array is an array of size 4 in which the size of each sub-array is not the same.

View page
Featured study guide

A suffix is something that

It is necessary to pay attention to suffixes because they

What is an abstract noun that was made by adding a noun-forming suffix to the word root fair which means equal

Which of the words below is an occupation that was made by adding a suffix to the word root crime

➡️
See all cards
3.9
10 Reviews
More study guides
3.75
4 Reviews

4.25
8 Reviews
Search results