Category

Arrays and Fixed-Size Collections

Fixed-size collections in C++: built-in arrays, std::array, safe indexing, traversal, multidimensional layouts, and practical fixed-capacity techniques.

C-Style Arrays

C-style arrays are contiguous regions of memory where you store exactly (n) elements of type T. The size of the array, (n), is determined at compile time. int s…

Jul 14, 2026 →

Array Bounds and Common Indexing Errors

The valid indexes of a C style array are the numbers from 0 to one less than the number of elements. Every access must be within those bounds. Outside of those…

Jul 23, 2026 →

Looping Through Arrays

To visit each element of a C style array, the natural way is a loop that increases by one through each valid index from zero up to, but not including, the size…

Jul 14, 2026 →

Searching, Counting, and Updating Array Values

An array search is simply a traversal through each of its elements until the desired element is found, or until all elements have been looked at. Since C style…

Jul 23, 2026 →

Partially Filled Arrays and Tracking Used Elements

A C style array always takes up a fixed amount of memory. It stores a predetermined number of elements, determined by how it's declared. Often, the number of va…

Jul 23, 2026 →

Multidimensional Arrays

Represent rectangular data with two-dimensional C-style arrays, access cells by row and column, and traverse the structure with nested loops.

Jul 14, 2026 →

Working with std::array and Comparing It with C-Style Arrays

The std::array is a fixed size collection that improves upon a C style array, while preserving the same basic behavior. The number of elements is fixed at compi…

Jul 14, 2026 →

Arrays of std::string and Other Objects

Arrays can hold any single type of item, including std::string objects and objects of other class types. Each item is a complete object, and an array simply sto…

Jul 23, 2026 →
About CppLearn

CppLearn is an interactive, free reference for modern C++. In each lesson, you'll find out how the language works, rather than just lines of code that you can copy and paste. We cover concepts starting from beginner lessons on fundamentals and proceed to templates, move semantics, smart pointers, and areas that usually trap or scare C++ learners.