Module 4: Arrays

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/20

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

21 Terms

1
New cards

Array

A collection of data items, all of the same type, accessed using a common name.

2
New cards

One-dimensional array

An array that is like a list, where elements are accessed via a single index.

3
New cards

Two-dimensional array

An array that is like a table, where elements are accessed via two indices.

4
New cards

Vector

A one-dimensional array.

5
New cards

Matrix

A two-dimensional array.

6
New cards

Declaration of an array

dataType arrayName[arraySize];

7
New cards

Uninitialized arrays

Must have dimensions of their rows, columns, etc. listed within square brackets.

8
New cards

Array Index

A non-negative integer used to access elements of an array; starts from zero.

9
New cards

Initialize an array

To assign values to an array at the time of declaration using curly braces.

10
New cards

Accessing array elements

To retrieve or manipulate values in an array using indices.

11
New cards

Multidimensional array

An array that has more than one dimension, such as 2D or 3D.

12
New cards

Accessing 2D array elements

Use two subscripts, typically denoting row and column indices.

13
New cards

C++ array initialization

Arrays can be initialized at the time of declaration using brackets and values.

14
New cards

Array size

The number of elements an array can hold, which is fixed after declaration.

15
New cards

Common mistake with arrays

Forgetting that the first index starts at zero.

16
New cards

Floating-point array declaration

float mark[5]; // An array that can hold 5 floating-point values.

17
New cards

Example of a 3D array declaration

int threedim[5][10][4]; // A three-dimensional array.

18
New cards

Array of arrays

A way to conceptualize multidimensional arrays, where each element is an array.

19
New cards

Partial array initialization

Initializing some elements of an array while leaving others as zero.

20
New cards

Constant expressions for array dimensions

Dimensions used in C++ arrays must be positive integral constants or constant expressions.

21
New cards

Input and output of array elements

Using scanf and printf functions to take input and print elements of an array.