Multidimensional Arrays in C++ (2D arrays)
HTML-код
- Опубликовано: 9 мар 2024
- 2D arrays in c++ and multidimensional arrays in c++. In this video you will learn how to create 2D arrays and vectors and use them to represent tables, grids, and boards. A 2D array is also known as a matrix because it has a rectangle structure due to the fixed sizing of the arrays. Unlike a 2D array, a 2D vector does not necessarily have a rectangle structure since each vector can have a different number of elements.
If you need to review past C++ Topics:
Arrays: • Arrays in C++
Vectors: • C++ Vectors and Dynami...
C++ Playlist:
• C++ Programming Tutorial
Install C++ with VS Code:
• How to set up C++ in V...
Subscribe for more coding tutorials 😄!
You're the beest! Thank for the video
Why do you use size_t
This was explained in my video on for loops. But basically that is the type that vector.size() returns.
size_t (size_type) is an unsigned integer, meaning its 0 or postive. This let's you store more bits for numbers since you don't need to indicate negative numbers. You can't have a negative size so it wouldn't make sense to use an int, which can be negative.