 Hello, and welcome to this video as part of a series. Be sure to check out the link in the description's video for the full playlist, but hopefully you watch previous videos. And I'm trying to keep these short, so let's get going. I'm using Vim as my text editor, but you can use whatever editor you would like. And we're going to go into a file I've already created called arrays, which is right now, it's just your basic C program here with nothing in it. And we're going to create an array, an array is basically a list of things, and we're going to be looking at creating a basic array here. I'm going to say char, asterisk, my strings, and then these brackets, which is saying it's an array. We're going to say equal, then here in, and there's different ways to add things to arrays, we're going to use these curly braces. And I'm going to say one comma, two comma, in parentheses, three comma, four again, don't forget the parentheses, comma, and five, okay. So we've created this array. Now we want to make sure we have the length of the array. So we're going to do here is we're going to create another variable int for integer. It's an int and integer. So it's a number. We're going to say array length is what we're going to call it. And we're going to say, you would think you'd be able to say size of, you might think that, we've looked at that before in previous videos, get the length of strings. So we're going to say my strings, but we're going to take that and divide it by size of my strings, and then brackets zero. And that'll give you the number of items in that array, which in this case is one, two, three, four, five. And now we're going to say print F. And in here, we're going to say array count percent D backslash n for our new line. And then we're going to give it the variable that we're putting in place of that D, the D is a holder for this, and we're going to say array underscore length, okay. And we do that, we can save that, now we can say GCC array dot C dash O, we'll just call it array forward slash dot slash array, again dot slash just means you're running a command in the current directory in this particular case, it's called array. We'll hit enter and it says array count is five, which is right, one, two, three, four, five. Perfect. Let's go ahead and come back in here. And what we're going to do is, let's put a little line break in here. I'm going to say print F, and I'm just going to put this somewhere about there. Nice little line break there. Now we're going to do what's called a for loop, and it's going to allow us to loop. You can use for loops, there's different types of loops, while loops and for loops, but for loop is going to loop for a certain number of things and do something for each one of the items in the array in this case. We're going to say for and then parentheses. And then we have our curly braces that our curly braces are going to, anything between them is what's looping for each time we say it. So what we're going to do is we need an array in here, we're going to say, I'm sorry, an integer in here. So variable, we're going to say integer one equals zero. So we're going to create a variable. It's a number, it's zero, and then we're going to say, and we're going to loop. How long are we going to loop? We're going to loop as long as I is less than the array length. Which in this case is five. So and we can add stuff to that array because we're looking at that as a variable here. After we create the array, we can add stuff to that array and this loop should still work. Some may calling, but each time it loops, we need to take I, and if you just take a variable and an integer like this, and we say that integer plus plus, it means add one to it. So every time it loops, it's going to add one to it. Okay, it's going to start at zero and it's going to get the first aim in the array, which is at position zero. And then it's going to loop through, then it's going to go to position one, position two, all the way through to the last item in the array. Then we're going to do here is we're going to print f, and we're just going to print out the string. So in this case, our array is of strings, the words one, the word two, the word three. We're going to say percent s for string. We're going to give a new line character for each one, and we're going to do comma my strings, but which string? So we're going to say, I, okay, I realize I'm kind of skipping something here. We'll go back to it in a moment. So basically anytime you want to output a item in an array, you say the array name, and then here you give the number of that item. The first one would be zero because it's at position zero. It's the first thing in the list, but it's at position zero. We'll go more into that in a moment. I'm going to say to recompile that. And now if I type array, boom, it says array count. There's five. We'll line break here, and then it goes one, two, three, four, five. Now if we go back in here just to explain this a little bit more, I should have done this first. Let's go ahead and just take this, and I'm going to put it here, put that there, fix my indentation. Okay, so here we're going to say this is the count, right? Now here we're looping through each one, but if I wanted to, I can say any particular one of these. If I want the very first item in the list, again, it's the first item in the list. It's number one, but it's at position zero. So I can say zero. So now if I compile this and run it, you can see that the first item at position zero is one. If I go back in here, I can say two, which would actually be number three, because it's the third item, but it's the at position two. So compile that, run it again, and you can see it says three. So I hope that explains a little bit more. I should have shown that first, but again, you say the name of the array and then inside the brackets here, you're going to give the number of the one you want, the position you want. So this is number one, but it's at position zero, position one, position two. And what our for loop is doing here is instead of typing an actual number here, we're going through each one of these, we're starting at zero. It will loop, and the first time it will be zero, and then it will loop again, and it will then add one to it. In fact, we can add that into our array to show you what I can do here is I can say percent D, I'll say position, let's say item D is this, and then here I will say I, and I think I need a comma there. Let's go ahead and save that, and if I did that properly, okay, now we'll see that item zero is one, item one is two, item two is three, item three is four, item five is five, four is five. Now again, those are the positions, really not items. We could add in here, it would make more sense if I put zero in here, but we did set this since we are checking the length of the array here after we create it. We can add stuff to this array, so I can say six, or seven, and our array should still work, our program should still work because, again, we're calculating the length of it each time, and now we've gone through that list. So I hope that made sense, clear as mud? Good. You go to gitlab.com forward slash metalx1000, forward slash my bin, capital M, capital B. You'll get this project here under the C folder. You'll find tutorials, and you'll be able to find all the example code that goes along with the tutorial. We just did number five, arrays, so you can download this project or look at them one by one. You can see here when it loads, it's a little bit different from what I originally had, but then we added stuff to it, but go ahead and check that out. I might update that because I'm still working on those, and of course, you can always go to filmsbychrist.com, that's Chris Decade, there should be a link in the description. Here you can search through all my videos from my channels. You can also come up here and go software, which will allow you to go to my gitlab page, a scripts page, a notes page, so there's all different places where I keep code and notes on programming that I've created, and if you like my videos, think about supporting me. I'm a Patreon member over at patreon.com forward slash mail x1000 by clicking on this or a link in the description. Or if you want to do a one-time payment, there's a PayPal link here. I do hope that you have a great day.