 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can search whether a particular character is present or not in a string by passing string into function using pointer. Before starting, you can note my information. You can connect with me by following these details which are available in front of you. You can search my YouTube channel by typing my name Sanjay Gupta in YouTube search bar. My channel will be available there. You can open it and here you will be finding out various programming related playlist which are based on C, C++, Java, PHP, Python, etc. So various programming related videos are available in these playlist. So you can watch these videos to improve your programming skills. You can subscribe my YouTube channel by clicking on this red button so that you can follow my YouTube channel. Now I am going to implement solution of this problem. So here first I am including a header file that is stdio.h. Now I am declaring a function search whose return type is int. It will receive two arguments. First is character pointer and second one is character variable. So this statement is function declaration. Now inside main function I have to declare a character array and a character variable and integer variable f. Now with the help of printf I am going to display the message enter string on console. That function will receive the content which is provided by the user and all the contents will be stored inside str. Now again I am using printf statement so that I can print the message enter the character you want to search. So to receive that character I am writing scanf statement and the entered character will be stored inside ch. Now I have to call search function. So for that purpose I am writing this statement. Here search is a name of function. It will be passing two arguments str and ch. So str is character array and ch is character variable and the result will be received inside f variable. So this statement is function call. The result will be received inside f variable. So I have to check the value of f. So if f will be 1 then the message character is present will be displayed on console. Otherwise character is not present will be displayed on console and at last I am writing return 0. So this way I have implemented main function. Now I have to implement search function. So this block will be known as function definition. Here you can see I have used a pointer p which will receive base address of str character array and the ch will be receiving the value which is available in ch variable which is present in main function. So through p pointer I can access all the locations of str which will be compared with ch variable. Now I am implementing first time declaring a variable and I have initialized it with the 0. Now I am going to implement while loop. Its condition is strp not equals to null. So if this condition is true then loop will be repeated otherwise it will be terminated. So p is containing base address of str. It will be dereferenced with the help of str sign. So if its value is not equals to null then the condition is true otherwise it will be false. So inside while loop I have to compare strp with ch. So strp will provide value and ch is the character which I want to search. So if this condition is true then I can assign 1 into f variable and I can break the loop. So this way I have implemented f condition which is checking whether ch is available in character array or not. So after checking this condition if it is false then I have to increase p so that p can move to the next location of str array. So this way I have implemented the while loop which will check whether the character is available in the string or not. After completion of this while loop I have to return the value of f. So f will be containing 1 if character is present otherwise f will be containing 0. So the returned value of f will be received inside f which is available in main function at line number 13. Then it is checked if f is 1 then character is present otherwise character is not present. So this way I have implemented the complete solution in front of you. Now I am going to execute this program. I am entering sanjay as the string and I am entering a as character which I want to search. So you can see the output character is present is displayed. So this way I have checked whether the character is available. Now I have to check whether the character is not available. So this time again I have entered sanjay. Now I am going to search the character m. You can see the output character is not present is displayed on console. So this way the program is working properly in both the ways whether the character is present or not. So here in this program I have passed string into a function and in a search function definition that string is persist with the help of a pointer. So I hope you have understood how we can pass string into function using pointer to search whether a character is present or not in a string. 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.