 Hello friends. I am Sanjay Gupta. In this video I am going to demonstrate you how to count frequency of a character in 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. My channel will be available there. You can open it. Here various programming related playlists are available which are based on Java, C, C++, Python and PHP. So you can improve your programming skills by watching these videos which are available in my channel. You can follow my youtube channel by subscribing my youtube channel by clicking on this red button. Now I am going to implement solution of this problem. So I am including a header file first which is stdio.h. Now I am going to declare a function whose name is count. Its return type is integer and it will receive two arguments. First argument type is character pointer and second one is of character type. So this statement is function declaration. After that I have to define main function. Inside main I am declaring a character array and variable ch and a variable integer type variable that is c. Now with the help of printer the message enter string will be displayed on console. To receive that string I am using gattas function. So the entered string will be stored inside str. Now again I am implementing printf statement which will display the message enter character you want to count. So this character will be received with the help of this scanf and the character will be stored inside ch. Now I have to call count function. So this statement is function calling statement. Here in this function you can see I have passed two arguments. First one is str character array and second one is ch character variable. The result will be stored inside this c variable. Now I can print the value of c on console. So count equals to percent d and then c. So the frequency will be displayed with the help of this c variable and then return zero. So this is the complete implementation of main function. Now I have to define count function definition. This block will be known as function definition. Here you can see I have declared a pointer p which will receive base address of str and ch variable which will receive the value available in ch that is declared in main function. Now I have to implement a while loop through which I can check how many times ch is available in the string. So I am implementing while loop. So this is the condition strp not equals to null. So p is containing base address. I have dereferenced it so that I can find out its value. So if this value is not equals to null then only loop will be repeated otherwise it will be terminated. So here I am applying the condition strp double equals to ch. So if this condition is true it means ch is equals to strp. So you can say ch is available in the string. So I can increase the value of c by c++. So this way I have incremented the value of c. Now I have to increase value of p. So p is the pointer which is having base address of the character array. Now I have to move to the next location of character array. So I have incremented the pointer by one. So this way this pointer will be moving to the next location that is available in str and then next character will be checked whether it is equals to ch or not. So after completion of this loop I can return the value of c so that it can be received in main function at line number 13 and the output can be displayed on console. So this way I have implemented the complete solution in front of you. Now I am going to execute this code. I am entering Sanjay which is my name. I am entering a character A. So you can see the counted value is equals to 2. So A is available two times in my name. So it is printing the output properly. I have implemented this program by passing string into function using pointer and it has counted frequency of a particular character in string. 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.