 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can add elements of two dynamic 1D arrays in C++. Before starting the demonstration, you can note my information, you can connect with me by following these details, you can download my app Techimage that is available on Google Play, you can search my channel by typing my name on YouTube, my channel will be available, you can click on my icon, you can subscribe my YouTube channel by clicking on this red button, here various programming related videos and playlists are available, you can select these playlists to watch any kind of video related to programming languages. Now coming onto the topic, in this demonstration, I will be explaining a code in C++ which will add elements of two 1D arrays created dynamically. Here header file IO stream is included, then using namespace std statement is included or using std namespace, it is a predefined namespace, name of class is vector, whenever we create dynamic arrays, that dynamic array is treated as vector, that's why I am using vector as name of class, then pointer p and size variables are declared, inside public section five functions are declared, set size, destroy, read, print and sum, so all these functions are defined outside the class, so I am explaining these functions one by one, first function is set size, here void is written type, vector is name of class, then scope resolution operator, then set size is name of function, inside this function cout will display enter size and size will be received by this size variable, then using this statement p equals to new int size, memory will be allocated, so new is an operator which will allocate dynamic memory at run time, it will allocate integer type memory and size will be provided this size variable and the base address will be stored inside this p, then to deallocate dynamic memory, destroy function is defined, here delete p statement is written which will destroy all the allocated memory which is allocated by new operator, after these two functions read function and print functions are defined, so this is definition of read function, here a loop is implemented starting from zero to size, it will receive all the elements using scene statement, then next function is print, it will display all the elements by this loop using cout statement, so these two functions are very simple, now for addition purpose this function is implemented which is void, vector, scope resolution, here two arguments are received, v1 and v2, these are formal parameters, so when this sum function will be called inside main, two arguments will be passed, v1 and v2, these are received here, then i is loop counter, loop is implemented, it is starting from zero to size, then this statement is adding all the elements of two 1d arrays, so v1.pofi is first arguments array, v2.pofi is second arguments array, values are added and these values are assigned into pofi, this pofi is representing implicit arguments array, so in this function called v3 is implicit argument and v1 and v2 are explicit arguments, so v1 and v2 both are received here, but v3 is directly accessible using this notation pofi, so v1 and v2 both are added and assigned into pofi, this pofi is representing v3, so you can say v1 and v2 both are added and the results are stored inside v3, now after this code main function is implemented which is having three objects v1 v2 v3, all v1 v2 v3 are calling set size function, so that size will be received from the user, then v1.read is called, then read function is called by v2, so two arrays v1 and v2 both will be read from the user using these function calls, then some function is called, result will be assigned into v3, then v3 is displaying the result using print function call, then after completion of all the function calls destroy function is called by v1 v2 and v3 and then return 0 statement is available, so this is the complete explanation of the code, now I am going to execute it, you can see it is asking for size, so I am entering size of first array, then size of second array and then size of third array, now it is asking values for first array, I am entering 5 times 1, then values for second array I am entering 5 times 2, you can see it is showing some 3 3 3 3 3 5 times, so friends this way I have added all the elements of two dynamic 1D arrays and the result is stored inside third 1D array, I hope you have understood the code well, if you want to watch more programming related videos you can subscribe my YouTube channel, you can visit my channel on YouTube by typing my name, here various programming related videos and playlists are available, you can follow these if you want to learn programming, thank you for watching this video.