Introduction

This section will introduce you to the most basic of collection classes, an Array. The objectives of this section are:

  1. Declare an array
  2. Load an array
  3. Display the data in an array

What is an Array?

  • An array is a simple collection of common data (all the elements have the same data type)
  • Think of how you store all email or phone contacts. You can add, delete, or edit the list, but this list is very much like an array

Arrays in Computer Memory

array-in-memory

An array takes up a contiguous block of computer memory.

Array Indexing

array-indexing

In C# arrays will always use zero-based indexing. This means the first element of the array will be index = 0.

Coding Topics

1D Arrays
Parallel Arrays
2D Arrays
Searching Arrays
Mode of an Array
Randomize an Array

Practice Problems

Array Problems 1
Array Problems 2
Arrays Exercise 1
Arrays Exercise 2
Arrays Worksheet 06a
Arrays Worksheet 06b

CPSC1012 Home