 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can perform string concatenation by passing string into function 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 tech school. You can download my programming app Techimace which is available on Google Play. Now I am going to implement solution of this problem with the help of C programming. So first I am including a header file that is stdi.h. Now I am declaring a function that is concat. Its return type is void and its argument type is character pointer and character pointer. So it will receive two addresses of two character arrays. So this statement is function declaration. Now I am going to define main function. Inside main, I am declaring two character arrays S1 and S2. Then with the help of printf, I am going to display the message enter string 1. Then through gattus, first string will be received from user. Now through printf, again I am going to display the message enter string 2. So again gattus will receive the entered content and that content will be stored inside S2. Now I am going to call the function concat and I am passing S1 and S2 string inside it. So this statement is function call. After completion of this function call, S1 will be modified. It will be having contents of S1 as well as contents of S2. So I can print this string on console. So this way S1 will be displayed on console and at last I am writing returns 0. So this way I have implemented the complete definition of this main function. Now I have to define concat function definition. In this first header line, I am receiving addresses of both the character arrays into pointers p1 and p2. And this block will be known as function definition. Now inside this function definition, first I have to move to the ending position of S1 character array through p1 pointer. So for that purpose, I am applying while loop. Here you can see condition is S risk p not equals to null. So p1 is containing base address of S1. Now I have dereferenced it with asterisk sign. So it will provide first value of that character array. So asterisk p1 will be providing first element. If it is not equals to null, then I have to increase p1 to the next location. So this loop will be repeated until null is available. So if p1 is pointing to null position, then this loop will be terminated. So after termination of this loop, p1 is pointing to the null position. Now from that null position, I have to copy contents of S2. So for that purpose, I am implementing second loop, asterisk p2 not equals to null. So inside this loop, I have to copy contents of S2 into S1, but through p1 and p2 pointers. So I am writing this statement. So p1 is having addresses of S1 and p2 is having addresses of S2. So p2 is pointing base location now. So base location contained will be copied into p1 and p1 is pointing to the null position of S1. So at the end of S1, all the contents of S2 will be copied through this statement. Now for increment operation, I am applying p1 plus plus and p2 plus plus. So this way, all the contents of S2 string will be copied into S1 at the end of S1 string. At last, I have to copy null explicitly because p2 pointer will not be copying null in p1 pointer. Or you can say from S2, null will not be copied into S1 because when null will be occurring, this loop will be terminated, which is available at line number 22. So this way, I have implemented the complete code in front of you, which is concatenating contents of S2 into S1 string. Now I am going to execute this code. So in first string, I have entered Sanjay. In second string, I have entered Gupta. You can see the output. Concatenated string equals to Sanjay Gupta. And I have displayed only S1. So the concatenated string is S1, which is having contents of both S1 and S2 strings. And I have passed both the strings into function with the help of pointers. So pointers are concatenating contents of S1 and S2 in this program. So this way I have implemented the code in front of you. I hope you have understood the logic well. 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 Techimus, which is available on Google Play. Thank you for watching this video.