 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can create one D array dynamically in C++. Before starting, you can note my information, you can connect with me by following these details. You can download my app TechMS that is available on Google Play. If you want to watch more programming related videos, you can search Sanjay Gupta that is my name on YouTube. My channel will be available. You can see it. It is visible here. If you click on this icon, you can see all the playlist related to various programming languages are available here. You can select any playlist, whichever you want to view. You can also subscribe my YouTube channel by clicking on this subscribe button. Now coming on to the topic. In this video, I am going to demonstrate you how you can implement dynamic one D array in C++. First of all, I am including a header file IO stream. Then I am using a namespace that is STD. It is predefined in IO stream and it is for scene and see out. Now name of classes vector in programming dynamic arrays are known as vector so that I am using vector as name of class. Now I am declaring a pointer p and a variable size. Inside public section, I am declaring first function set size, second function destroyer, third function is read and fourth function is print. After termination of class, I will be implementing definitions of these functions. So first function is set size void is return type. Then I have to use name of class because I am defining these definitions outside the class. This scope resolution operator is available. Then set size is name of function. Inside this function, I am going to implement the code which will create dynamic array. First, I have to read size of array from user. So I am implementing see out which will display enter size messes. Then size variable will see the size from the user. Now p equals to new int size. This statement will create dynamic memory. So new is an operator which will create dynamic memory of integer type and size will be provided by this size variable and the beginning address will be assigned into p. So this way we can create dynamic array and this dynamic array is 1D array. After this function definition, second function is destroyer. So void is return type, vector is name of class, then scope resolution operator, then function name destroyer. Here I am using delete operator to delete the dynamically allocated memory. So this deallocates dynamically allocated memory. So with the help of this set size function, I have allocated dynamic array and with the help of this destroy function, I have deallocated dynamic memory. Now I am implementing third function that is read. Inside this function, I variable for loop counter. Then loop is starting from zero and it will repeat till this condition is true. That is I less than size. Here size variable is used because size is provided by the user. So I can't use any constant value here. Then c in p of i. This is read function. Now fourth function is print. Again I am declaring i variable. Then for loop starting from zero condition is I less than size. Here I am implementing cout which will display elements of p of i and I am mentioning and L and L is for line termination. So these four functions are defined successfully. Now I am implementing main function inside main. I am creating object of vector class that is v. Now I am calling v dot set size then v dot read then v dot print and v dot destroy. So all four functions are called here. At last I am returning zero because return type of main is integer. Here I am also passing a message enter values and before print you have entered this message will be displayed and then line will be terminated or change using and L. So friends this is the complete implementation of the code. You can see I have implemented four functions. First one is set size second is destroy third is read and fourth one is print. All the functions are called inside main function. Now I am going to execute this code. It is asking for the size. I am entering five. Now I have to enter five values. So I am entering one two three four and five. You can see it is showing you have entered one two three four five. This time I have created array for five size. Again I am executing this code. This time I am entering seven as size. So now I have to enter seven elements and it is reading all the elements successfully and it is displaying all the elements back on the console. So friends I hope you have understood how you can create dynamic arrays which will receive size from the user and according to that size memory will be allocated. Elements will be entered and the elements will be printed back on console. You can apply any other operation like addition subtraction that I will be demonstrating in my another videos. If you want to watch more programming related videos you can subscribe my YouTube channel that I have already demonstrated you how you can search my YouTube channel on YouTube. Thank you for watching this video.