 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can compare two strings 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. So here you can see I have implemented a code in front of you. First statement is header file inclusion. Then I have declared a function whose name is compare. Its return type is int and its argument type is character pointer comma character pointer. So two addresses will be passed of character type. That's why these two pointers are declared here. Then inside main function I have declared two character arrays. One variable integer type F. Then printf statement will display the message enter string 1 on console. The enter string will be stored inside S1 through GATUS. Then again printf will be displaying the message enter string 2 on console. The entered characters will be stored inside S2 through this GATUS function call. Now I am calling compare function. So this statement which is available at line number 12 is function call which is passing both the character arrays S1, S2 in function and the return value will be received inside F and if condition is checking whether F is 0 or 1. So if it is 0 then strings are equal otherwise strings are unequal. So this is the definition of main. Now you can see the definition of compare function. Here P1 and P2 pointers are receiving base addresses of S1 and S2. Now variable F is declared which is initialized with 0. Now see this while loop. Here first condition is strp1 not equals to null or strp2 not equals to null. This is second condition. So if any one of the condition is true then this loop will be repeated otherwise it will be terminated. If both the conditions are false then only it will be terminated. So P1 is having base address of S1 character array and P2 is having base address of S2 character array. So after this condition is true then again if condition is available which is checking strp1 not equals to strp2. So P1 is having an address if its value is not equals to the value which is available at address which is stored inside P2 then if condition will be true and one will be assigned into F and loop will be terminated because break is available here. So if contains are not equal then only loop will be terminated otherwise P1 will be incremented by one and P2 will be incremented by one so that P1 and P2 pointer can point to the next locations of S1 S2 arrays. So if loop is terminated in middle then F will be one because before break one is assigned into F and F will be one because this condition is true means contains of strings are unequal otherwise loop will be repeated until this condition will be false. So after completion of this loop I can return value of F so F will be returning zero or one. So if it is returning zero then you can see here condition is written in main function the message strings are equal will be displayed otherwise strings are unequal will be displayed. So this way I have implemented the complete code in front of you. Now I am executing this code in first string I am passing Sanjay and in second I am passing Gupta. You can see the output strings are equal is displayed on console. Again I am executing this code. This time I am entering same contained in both the strings. So the output is strings are equal. So program is working properly in both the cases. So this way I have compared two strings by passing string into function using pointer. 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 Techimage which is available on Google Play. Thank you for watching this video.