C Program to find number of vowels in a string

In this example you are going to learn how effectively you can able to write a C program to count the vowels in a String.

This program covers the below concepts:

1. String in C
2. String Array in C
3. Check if a char exists in a String.

The code is self explanatory, just read the comments in the above program to understand it step by step.

You need to import two packages:
1. stdio.h – Handles input & output operation
2. string.h – Handles String operations

strchr() function helps to check if a character exists in a string. So basically we are looping the vowels one by one and comparing with the entered string (mystring). If any one of the vowel is present in the mystring, then incrementing the value of j by 1 (j++).


Related Posts

Leave a Reply