 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how to access and modify elements of array using pointers. Before starting, you can note my information, you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tech school. You can download my programming app Techimace which is available on Google Play. So in this video, I will be demonstrating you how you can access the elements of array through pointer and how you can modify various locations of array with the help of pointers. So first of all, I am going to include a header file that is stdio.h. Then I am defining main function. Inside main function, I am declaring two arrays a and b. And to point these arrays, I am declaring two pointers that are p1 and p2. And one more variable that is i. Now first I am going to display the message. Enter 10 elements on console. Now to receive those 10 elements, I am applying a for loop which will repeat scanner statement 10 times. So this scanner statement will read all the 10 elements and those elements will be stored inside a array. Now as I earlier said that I will be demonstrating you how to access and modify array elements using pointer. So now I am assigning address of a array into p1 and base address of b array into p2. Here you have to remember that name of array provides base address of the array. So here a is assigning base location address into p1 and b is assigning base address into p2. So through p1 I can access the elements of a and through p2 I will be modifying the values of b array. So in this program till now you can see that a is containing 10 elements but b is containing only garbage elements. So I will be accessing locations of a and then I will be copying those locations value into b array but all operations will be done with the help of pointers. I will not be using a and b arrays directly. I will be accessing them with the help of pointers. So now I am applying a for loop. This for loop will repeat 10 times. So to access the locations I am using this statement. So see it carefully here asterisk p1 will access the location of a array and that locations value will be copied into asterisk p2. So asterisk p2 will be modifying the values of b array. Now if I want to move these pointers to the next locations then I have to apply p1 plus plus and p2 plus plus. So initially p1 and p2 are pointing to the base location or base address. To point next locations I have to increase these pointers by 1 or by 2 or by n. So for that purpose I have incremented these pointers by 1 every time this loop will repeat. So this way p1 is copying all the locations values which are available in a array into b array. So this is done with the help of pointers. Now after completion of this operation I can print the values of b array on console. So the message is second array contains to print the values I am using a for loop and here see that for printing the elements I am using b array instead of pointer. So reading and printing both are done with the help of arrays but copying of elements from a array to b array is done with the help of pointers. So if you want to process any array with the help of their addresses then you can prefer pointers. So this way I have copied all the elements which are stored inside a array into b array with the help of pointers. Now I am going to execute this code so that you can understand how the program is working properly. So after execution I have to enter all the elements inside array. So you can see I have entered 10 elements in a array. Now you can see the output second array contains all the elements which are available inside a array are also available inside b array starting from 1 to 10. So this way I have accessed the locations values of a array through p1 pointer and I have modified the locations of b array through p2 pointer and I have copied all the locations of a into p sorry all the locations of a array into b array. So this way through pointer you can receive the values of array and you can modify the values of array. I hope you have understood how I have demonstrated you this process. If you want to watch more programming related videos you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tax school. You can download my programming app Techimage which is available on Google Play. Thank you for watching this video.