Display the number of vowels in a given character array using pointers
Program to display the number of vowels in a given character array using pointers is discussed here.
Let us consider a sample character array: FACE Prep. The number of vowels is 3 and consonants is 5.
The algorithm to display the number of vowels is as given below:
Read a string as input from the user.
Assign the address of the string to the character pointer.
Increment the pointer when the character is a vowel.
Input the string from the user. Assign the input character array to the pointer. Scan all the input characters. If it is a vowel, increment the cntV variable and if it is a consonant, increment the cntC variable. After all the characters are scanned, display the total number of vowels and consonants.
Program to display the number of vowels in a given character array