Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini-course: Arrays in C++ (from basics to advanced)

This mini-course covers “classic” C arrays (T a[N]) and modern STL alternatives (std::array, std::vector, std::span), focusing on safe usage, passing to functions, and algorithms.

Prerequisites

  • A compiler with C++20 support (e.g., g++ 10+ or clang++ 12+).
  • A terminal and basic build knowledge.

How to build and run

One example (replace with the file you want):

g++ -std=c++20 -O2 -Wall -Wextra -pedantic -g 01_basic_c_array.cpp -o app
./app

Build all examples (one executable per file):

for f in *.cpp; do
  g++ -std=c++20 -O2 -Wall -Wextra -pedantic -g "$f" -o "${f%.cpp}"
done

Run, for example:

./10_stl_algorithms

Index (modules)

  1. Setup and recommended flags
  2. Basic C array
  3. Initialization and sizeof
  4. Array-to-pointer decay (classic pitfall)
  5. Pointers and iteration
  6. Passing arrays to functions (4 ways)
  7. std::array
  8. 2D arrays and flatten (row-major)
  9. Dynamic: new[]/delete[] (educational) and RAII
  10. std::span and views
  11. STL algorithms on arrays
  12. Mini-project: ring buffer with std::array
  13. Pointer to array vs array of pointers

About

C++ Arrays study

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages