Key Concepts

Review core concepts you need to learn to master this subject

arrays

#include <iostream> using namespace std; int main() { char vowels[5] = {'a', 'e', 'i', 'o', 'u'}; std::cout << vowels[2]; // Outputs: i char game[3][3] = { {'x', 'o', 'o'} , {'o', 'x', 'x'} , {'o', 'o', 'x'} }; std::cout << game[0][2]; // Outputs: o return 0; }

Arrays in C++ are used to store a collection of values of the same type. The size of an array is specified when it is declared and cannot change afterward.

Use [] and an integer index to access an array element. Keep in mind: array indices start with 0, not 1!.

A multidimensional array is an “array of arrays” and is declared by adding extra sets of indices to the array name.

What you'll create

Portfolio projects that showcase your new skills

Pro Logo