Sahaj.blogs

Day page

22 Nov 2023

Study

C++ · Arrays

C-style arrays, std::array, 2D arrays, out-of-bounds risk, and why .at() exists.

  • A C-style array doesn't know its own size once passed to a function; std::array does.
  • arr[i] doesn't check bounds; arr.at(i) does and throws std::out_of_range.

Read the post →