Hello and welcome to the 30th tutorial and a c++ programming series. And in this problem we're looking at multi dimensional arrays. multi dimensional arrays are essentially arrays of arrays, and they can be arrays read or either arrays, so forth. They can have as many dimensions and they need but huge arrays can take up huge space in memory. So just be careful with what you're doing. What we won't be dealing with in the two by two dimensional array for simplicity, but it can be easily extended for different circumstances.
Let's go ahead and open up our project. Okay, so first one is to declare a regular array, you do the datatype. The array name comes up. You will do the datatype you do the array name, call Ray. very innovative as you can see Then you would put how many elements, we can do it in another way, but generally how many elements you will have in your array. So free multi dimensional array, you'll simply put another square bracket and a number.
So it's going to be two, I'd say you can have a lot larger, but for simplicity, and be careful when you doing this, especially on mobile devices will signal first is about your mobile devices. memory can be used quite a lot to Sorry about that, this my phone. So what we have here you can essentially think of these two arrays, again, very sorry, as to arrays, so you have a rate one, so array zero, which has an array of free elements, array, index one, which has a number array of free elements. So essentially, this multi dimensional array can hold a fixed element. So let's just show you how you would access it. So you do the array name, the index one which is a second array, In this instance, then to this is basically the last element in that array.
And in fact, the last element of this multi dimensional array, it's adding value to it, you would normally so 45 seven wherever you want to do it. And now we're just going to see this array write, one, which is the second array, two, which is the third and last element in on the array and the entire multi dimensional array, STD and line semi colon. Now if you want to open up the debugger first. Except for again, we have 45. And obviously, you can change this number to one if you want to. And as you can see, there's an arbitrary value there.
Even though we've assigned value we're retrieving it from index One, two, is that a one one so for this change 20 111 There we go. 45 That's how you do dimension multi dimensional arrays. In the next part of this series we'll be looking at references. And as usual, thank you for watching. I forgot one thing, or the recoiling for source code will be in the description. If you have any questions feel free to message us at support at sonar system calm Okay, the email will be in the description you can comment on the video or directly messages via YouTube.
And now let's do it. Thank you for watching and I hope you have a nice day.