 Hello friends, myself Rohit Kumar Vakhtarikar working as an assistant professor in computer science and engineering department at Walsh Institute of Technology, Solapur. Today, we are going to see the array list using STL, Learning Outcomes. At the end of the session, students will be able to perform different operations on array using STL, that is Standard Template Library. Well, let us start. So array is a collection. So array is a collection of the homogeneous objects. It supports the following operations. What we are going to do? Homogeneous objects means what? It is going to store the same data types, values in an array. So can we perform the direct operations on our array? Yes, that is possible. We can perform these different operations like front, back, at, fill or swag. There will be the different operations like front. What is going to retrieve the front element? The back is going to retrieve the last element, at is, you retrieve at a specific specified index element. So fill. We can fill that array with some different values and even we can swap the two arrays values by using the swap method. So let us take some practical views. So see here, we have already implemented those programs. So for that what we need in our code, we need to include this array. First this array will allow us to use the Standard Templates. So now what is meant by Standard Templates? With the help of the Standard Templates, we can use the inbuilt functions where there is no need to create our own methods. So let's say, now let's say we want to create the array of integer with some Phi size. I want to store the Phi elements. So now here, we need to specify like array in the angular bracket integer of Phi. Means what? This array has two parameters. One is a data type and another one is the size. So now here I am going to specify the int size int data type with the Phi element. So now here we can store 1, 2, 3, 4, 5. These are the elements we have stored in our array. So now next one is what? In the same way we have declared one more array 2 with some Phi elements like 6, 7, 8, 9, 10. So now in this code what we have done, we are just trying to display the inserted element and here also we are just displaying the elements of the array 2. So now we will have here to array 1 and array 2. So let's see what it is going to perform. So now for that what we need to do, we need to perform build and run. So let's say we have simply done that one. So here see in the array element, one element will have the 1, 2, 5 elements. In array 2 we will have the 6, 2, 10 elements okay fine. So let's say what if I want to add a one more element here let's say 6 and here I want to add a 11 fine. So let's build it. What we will get? Obviously we will get the error right. Why? Why we are getting this error? Because here what it is going to display? See here this is the error right. So now how we are going to remove this error? See in array 1 and array 2 we are going to insert the 6 element and what we have done we have declared the array with a 5 right. So what if I will make it as a 6. So now once I will make it as a 6 and I will save and I will build and run then I will get the output see here right I am getting the result fine. So still it is going to display only the 5 elements because we have not iterated our for loop till 6 right see here. The code was executed last time but it is not shown the result. Now let's see here. We will have the 1 to 6 element and 6 to 11 element. So in this way we are going to store the total number of 6 elements right. So let's see the other operations. Now here what if I want to retrieve the element at a specific position right element at specific position right let's say I want to second position element. So what I will do simply array 1 array 1 is what we will have declared 1 array right here this is our array 1. So from this array 1 I want to retrieve the second element that is array of 2 fine. So see here what it is going to display see. So element at the second position from the array is 3 right 0 1 and 2 this is the second position right what we have done the at array 1 at 2 means what we have given the 2 index. So index will start from what 0 right. So this 0 1 and 2 on the second index position we are getting the element third. So that's why it's a third position okay. So now what if I want to retrieve the front element of a specific array. So what we will do for front element means what the first element from the array right. So I want to perform some operation like array 1.front. So it is going to retrieve the first element here see the element the first element of the array is 1 see array 1 first element is 1. So in that way the array 1 has a last limit is 6 right. So how we are getting that one simply by writing array 1.back right. So here we are getting the array 1.back. So simply we will get the last element fine. So last element in array 1 is 6 right. So front and last are the 2 inbuilt functions as well as provided to retrieve the first and last element from the array fine. So let's say what if I want to perform one operation which is going to fill that particular array with a specific element right. Let's say I will have the 100 of size array and there will be 100 elements in my array. I want to set the values of that array with some specific value let's say I want to make it as 1 right the complete array I want to make it as 1. So what we will do here simply they have here one more option right array 1.fill of 1. So here array 1 has a element 1 2 3 4 5 6 but when I will say array 1.fill with this 1. So it is going to fill the complete array with 1 1 1 1 1 1 right. So if I want to set some default values let's say I want to make it as 100 fine and I want to simply run it. So let's check what it is going to do. So what it has done the array elements are after fill operation. Fill operation or fill function when we will done at that time we are getting the 100 100 100 in our complete array right. But still here will has a size as a 4 0 to 4 we are getting it means 5 why because we need to update our for loop right our for loop is at the 6 fine. So here we need to simply make it as a 6. So now we will get the elements till 5 right. So these are nothing but the index 0 1 2 3 4 5 are the index of my array 1 fine. So in this way we are getting the values. But let's say this code has retrieving that values fine. Now let's say I want to perform this swap operation means what we will have the 2 arrays right from this 2 arrays I want to swap the content of those array. I want to swap the array 2 values into the array 1. So what we will do we will have a simple one function that is called the swap function right this is a swap function. So now in this way function what we will have array 1 dot swap of array 2 means what array 1 is going to fill with the array 2 values right. So what we will have the array 2 in array 2 we will have the 6, 7, 8, 9, 10, 11 right. So now currently in array 1 what we will have we will have the 100 right because we have done the fill operation. So let's run this code and check what it is going to do. See here so array 1 so now here array 1 elements are what we will have 0 1 2 3 4 5 right. But here what we are getting 6, 7, 8, 9, 10, 11 right. Why because we have done this operation fine. So after swap operation we are getting these values fine after swap operation we are getting these values. So hope everyone is getting these concepts fine. So let's say we have seen this all the functions. So now let's I will ask one question think and write is it possible to store the heterogeneous values in the array by using stl think and write your answer. Now right because array stores only homogeneous values it is not allowed to store the heterogeneous values. References are observable inter-programmings with a C++ 6 relation by Ival Ghosh. Thank you.