 Hello friends. I am Sanjay Gupta. In this video, I am going to demonstrate you how you can compare two strings by passing strings into function. 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 TechMS which is available on Google Play. Now I am going to implement the solution of this problem with the help of C programming. So first time including a header file stdio.h. Now I am going to declare a function whose name is compare. Its written type is integer and it will receive two arguments of type character array. So this is function declaration. After function declaration, I am defining main function. So inside main, I have to declare two arrays of type character. So name of arrays are s1 and s2. Now I am declaring a variable integer type variable that is f. Now with the help of printf, I am displaying a message enter first string to receive first string. I am using GATUS function. So GATUS will read all the contents entered by the user and those contents will be stored inside s1. Now again, I am implementing printf function which will display the message enter second string on console. To receive the entered contents from console, GATUS function is again called and here s2 string is passed inside GATUS function. So after reading process, I have to call compare function. So for that purpose, I am writing this statement. This statement is function calling statement. So in compare function call s1 and s2 will be passed as an argument and the result will be received inside f. Now I have to compare f. So if f will be receiving value 0, then I am going to print strings are equal. Otherwise I can print strings are not equal. So this way I have compared both the strings by calling the compare function. After this main function implementation, I have to define the definition of compare function. So now I am going to define compare function definition. So you can see this block will be containing function definition. Now inside this function, I am first declaring a variable I and then variable f which is initialized with 0. Now I am implementing a for loop which is initialized with 0. So here variable I equals to 0 is the initialization. Then s1 of I not equals to null. This is first condition using all operator. I am applying another condition that is s2 of I not equals to null. So if any one of the condition is true, then this loop will repeat. Otherwise loop will be terminated inside this for loop. I have to apply if condition that is s1 of I not equals to s2 of I. So if this condition is true, that means s1 contained is not equals to the contents of s2. Then I can assign one in f variable and I can break the loop. So if contents are unequal, then only f will be receiving one and loop will be terminated. Otherwise this loop will repeat until this condition is false. So loop will be repeating every time. This if condition will be checked. If it is true, then only f will be receiving one. Otherwise after completion of this loop, f will remain 0. So now after completion of this loop, I can return the value of f. So if f is 1 or if it is 0, in both the cases, the returned value will be assigned inside the f variable which is available at calling statement. So if f is 0 at calling statement, then it will print strings are equal. Otherwise the masses strings are unequal will be displayed on console. So this way I have implemented the comparison logic in front of you by passing strings into function. Now I am going to execute this code. So it is asking for first string, I am entering Sanjay and second string I am entering Gupta. So you can see the output is it is showing strings are not equal because contents are unequal. Now in both the strings, I am entering Sanjay. So you can see the output. It is showing strings are equal. So this way the program is working properly. It is showing the correct results in both the cases whether the strings are equal or not equal. So I hope you have understood how we can pass strings into function for comparing them. If you want to watch more programming related videos, you can follow or subscribe my YouTube channel through the URL youtube.com. You can download my programming app TechMS which is available on Google Play. Thank you for watching this video.