 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can compare two strings 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 tech emiss, which is available on Google Play. Now I am going to implement a code in C programming, which will compare two strings using pointers. So first time including a header file that is stdio.h. Now I am defining main function. Inside main function, sorry, first time declaring two arrays S1 and S2, then two pointers P1 and P2. Now I am declaring an integer variable F, which is initialized with zero. Now to receive contents of both the strings, first time using printf, which will display the message enter first string. The elements of first string will be received from user through gattus. Now second printf will display the message enter second string on console to receive the elements. I am implementing gattus again. So the enter contents will be stored inside S2. Now I have to assign base addresses of S1 and S2 into P1 and P2 pointers. So P1 equals to S1. This will assign base address of S1 into P1 pointer. So base address of S1 is assigned into P1 and in second statement base address of S2 is assigned into P2. Now I can access elements of S1 and S2 arrays through P1 and P2 pointers. So now I am applying while loop where condition is P asterisk P1 not equals to null or asterisk P2 not equals to null. So if any one of the condition is true, then this loop will be executed inside this loop. I am going to check asterisk P1 not equals to asterisk P2. So if value of S1 is not equals to value of S2 string, then this loop will be terminated. So before termination, I am assigning one into F and then I am applying break. So asterisk P1 is providing values of S1 character array and asterisk P2 is providing values of S2 character array. So if they are unequal, then F will be receiving one and this loop will be terminated. Otherwise this loop will repeat till this condition is true. If this condition which are available inside while they will be false, then only this loop will be terminated. Now after termination of this loop, I have to check the value of F. So if it is 0, then I can print strings are equal. Otherwise I can print strings are unequal. So this way I have implemented the complete code. Now here you have to notice that I have to apply these two statements also P1 plus plus and P2 plus plus because if I want to move to the next locations of character arrays, then I have to jump these pointers to the next location or you can say to the next address by incrementing them by one again and again. So now this program is implemented completely. I can execute this code right now. So first time entering ABC in first string and again ABC in second string. You can see the output. It is showing strings are equal. So both are having same contents that that's why it is showing strings are equal. Again I am executing this code. This time I am entering different contents. So it is showing strings are unequal. So in both the cases, the code is working properly. So you can see I have implemented the string comparison using pointers. I hope you have understood how we can check two strings, whether they are equal or not with the help of pointers. If you want to watch more programming related videos, you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjay gupta underscore tech school. You can download my programming app tech image which is available on Google Play. Thank you for watching this video.