 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can copy a string into another using pointer. Before starting, you can note my information. You can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore text pool. You can download my programming app tech image, which is available on Google Play. Now I am going to implement solution of this problem. So first of all I am including a header file. Then inside main function, I am declaring two character arrays. First one is S1 and second one is S2. Now two pointers P1 and P2. With the help of printf, I am going to display the message. Enter a string on console. To receive input from user, I am using GATUS, which will receive the entered value inside S1 with the help of GATUS function. Now for copying purpose, I am assigning addresses of these two character arrays into pointers. So here I have written P1 equals to S1 and P2 equals to S2. P1 P2 are pointers and S1 S2 are character arrays. So if I assign name of any array, then its base address will be assigned automatically into a pointer. So name of array provides its base address. So P1 is containing base address of S1 and P2 is containing base address of S2. Now for copying purpose, I am implementing while loop. Here condition is P, asterisk P1 not equals to null. So if this condition is true, then only the further statements will be executed. Otherwise this loop will be terminated. So now for copying operation, I am applying asterisk P2 equals to asterisk P1. So through this statement, elements of S1 array will be copied into S2. Now I am incrementing P1 by 1 and P2 by 1. So this way P1 and P2 will be pointing to the next location which are available in S1 and S2 arrays. So through this while loop, I am copying all the elements of S1 into S2. But here you can see I have used only pointers. So P1 is pointing to S1 array and P2 is pointing to S2 array. After completion of this loop, all the elements will be copied into second string that is S2. But null will not be copied because after checking this condition for null, this loop will be terminated. So null will not be copied. So for that purpose, I can write asterisk P2 equals to null. So I am explicitly assigning null into second string. Now I can print the copied string with the help of printf percent S and S2. So here you can see I am printing the copied string using S2 array. But for copying purpose, I have used only pointers. So whenever we access any array through pointer, pointer can update the elements of that array. Whether it can be integer or it can be character array. So now I am going to execute this code. I am entering my name in S1 string. You can see the output copied string equals to Sanjay. So whatever I have entered is printed back on console. So I entered the values into S1 and I printed the result through S2. So S1 elements are copied into S2. But you can see it is done with the help of P1 and P2 pointers. So this way I have demonstrated you how you can copy contents of a string into another using pointer. 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 tech school. You can download my programming app Techimace, which is available on Google Play. Thank you for watching this video.