 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can count number of spaces in a string. 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, Techimus that is available on Google Play. Now here I am going to implement a code with the help of C programming which will count number of spaces available in a string. So first time, including a header file that is STDIRotage. Then I am defining a function main. Inside main function, I am declaring a string then variable I and counter variable, which is initialized with 0. Now with the help of printf, I am going to display the message enter string on console. To read the string, I am using gattus str. So gattus function will read the entered string and that string will be stored inside str. Now I am applying for loop initialized with 0. Its condition is str of i not equals to null and then i++. Inside this loop, I am applying if condition which is checking whether str of i double equals to space or not. So I have applied space in single quotes because space is also a character. So if str of i is equals to space, then C variable will be incremented by one. Otherwise not. So with the help of this if condition, I am able to count number of spaces and counted value will be available inside C. After completion of this for loop, I can print the value of C which is containing number of spaces. So I can print spaces equals to percent and then C and return 0. So this way with the help of this for loop, I have checked a condition whether string is containing space or not. If its index is containing spaces, then I have incremented counter variable and after completion of loop, I have printed value of C on console. Now I am executing this code. So here I am going to enter a text. India is my country. So you can see India, then space, then is, then space, then mine and then space. So I have entered spaces three times. So the program is working properly. It is showing the correct result on console. So this way with the help of this example, you might have understood how we can count number of spaces which are available 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 sanjay gupta underscore tech school. You can download my programming app Techimace which is available on Google Play. Thank you for watching this video.