‫We'll come back.
‫In this video, we are going to have a look at some theory of arrays in C sharp and the next video.
‫We're going to see it in practice and we're going to see a demo.
‫So let's get started first with the theory behind it, because it's quite important to understand what
‫the general idea of a race is and how we can use them.
‫So an array stores a fixed size sequential collection of elements of the same type, so it stores a
‫fixed size.
‫And the important thing is it's only of the same type.
‫So you can store multiple information within one variable, so to say, but it has to be the same type,
‫so it cannot be in one spot.
‫You have a string in another, you have an integer and so forth.
‫It all has to be the same type.
‫Then you can create arrays of all different kinds of types, so you can create an array which only contains
‫integers.
‫Then you can create one which only contains strings, objects and so forth.
‫So pretty much everything can be stored in an array, but it has always to be the same type for that
‫specific array.
‫Then it's really great to store a collection of data.
‫It's easier to think of as a collection of variables of the same type stored at continuous memory locations.
‫So simply imagine it like some storage that you have and you can put information in it.
‫So this is a structure of an array.
‫In this case, it's an array with a length of six.
‫So there are six values within that array.
‫And in this case all of them are integers.
‫So you have the number 13, 15, five and so forth.
‫So these are different memory locations, but they are all within the same array and that allows us
‫to store multiple information in one variable so we don't have to create ten different variables or
‫50 different variables, but we can create one array which contains all of those information and we
‫can access them later on.
‫And what's important here is that we have indexes.
‫So in order to store something in an array, we need to store it at a specific index.
‫So for example, the 13 is at the index of zero, then 15 is the index of one and this order is always
‫maintained.
‫So it always starts at zero and it always goes up by one.
‫So in this specific array, the element and index four has a value of eight.
‫So this one here.
‫Is indexed for and the value is eight.
‫Now, in order to declare an array, you need to specify the data type.
‫Then you have the square brackets and the array name, for example, int grades.
‫So you can see here this is an array of grades.
‫So the students get grades and this is an example of a grades.
‫You could store all the different grades for your students.
‫Then in order to initialize an array, you have to go the following way.
‫You create the array with data, type again, then the square brackets the array name, then you need
‫to keyword new and afterwards you have the data type again and in square brackets the amount of entries
‫that this array should have.
‫So in the case below you have the grades which contains five grades.
‫So five whole numbers of type integer are within that array called grades.
‫Then in order to assign values to an array, you simply use the array name.
‫Then in square square brackets you enter the index as we've seen earlier, and then you add the value
‫after the equals sign.
‫So here grades at the position zero.
‫So at the index zero is 15 grades at the position or index one is 12.
‫So that's just some examples.
‫So here, going back to the structure of an array, you can see the array name at position four.
‫That's how you would get it has the value of eight.
‫So that's the basis of a race.
‫And we're going to see a lot more about a race.
‫There is a lot more to know about the race, but most of the things make much more sense when you do
‫them in practice.
‫So we're going to have some demo videos following.
‫See you there and have fun.