Module 4 of 4

Arrays in C++

9 lessons  ·  1D and 2D arrays, operations, functions

1

Introduction to Arrays

Topics covered

  • What arrays are and why they are useful
  • Declaring and sizing arrays
  • Arrays in memory — contiguous storage
2

Accessing Array Contents

Topics covered

  • Zero-based indexing
  • Reading and writing individual elements
  • Out-of-bounds access and undefined behaviour
3

Array Initialisation and Assignment

Topics covered

  • Initialising arrays at declaration with brace syntax
  • Partial initialisation and zero-filling
  • Assigning values using loops
4

Operations on Arrays

Topics covered

  • Iterating over arrays with for loops
  • Finding sum, average, min and max
  • Searching and sorting arrays
5

Arrays in a Function

Topics covered

  • Passing arrays to functions (passed by pointer)
  • Passing the array size as a parameter
  • Modifying array contents inside a function
6

Introduction to 2D Arrays

Topics covered

  • Declaring 2D arrays (rows and columns)
  • Accessing elements with two indices
  • Visualising 2D arrays as tables/matrices
7

2D Arrays in a Function

Topics covered

  • Passing 2D arrays to functions
  • Specifying column size in function parameters
  • Processing 2D arrays with nested loops inside functions
8

Operations on 2D Arrays

Topics covered

  • Iterating over 2D arrays with nested for loops
  • Row and column sums
  • Matrix addition and transposition
9

2D String Array

Topics covered

  • Arrays of C-style strings (char arrays)
  • Declaring and accessing 2D character arrays
  • Common string operations on 2D arrays