C Program To Count Vowel Characters from String

What is ASCII Code ?

ASCII is a American Standard Code for Information Inter-exchange which is standard that assigns letters, numbers, and other characters within the 256 numbers in the 8-bit code.

In C Programming , Every character variable holds ASCII value which is an integer number between 0 and 127 rather than that character.

ASCII value of Capital letter ‘A’ is 65 and ‘Z’ is 90. Means all Uppercase letters are in the range 65 to 90 and ASCII value of Lowercase letter ‘a’ to ‘z’ are in the range 97 to 122. All constants numbers ‘0’ to ‘9’ in the range 48 to 57.

String is a group of characters which is array of characters. As user enters characters , but internally it holds its ascii code.

Lets see example

char str_name[]=”Abcd”;

Actually the values in array positions as follows

str_name[0] = 65 means ‘A’ (upper case letters range 65 to 90)

str_name[1]=98 means ‘b’  (lower case letters range 97 to 122)

str_name[2]=99 means ‘c’

str_name[3]=100 means ‘d’

Following program is to count upper case , lower case characters & numbers from string. Here note that all special characters like * $ @ sign has ascii code. The ascii code for space is 32, ascii code for newline is 13.

To count upper case character, check each character for the range 65 to 90.

To count lower case character, check each character for the range 97 to 122.

To count constants ( numbers) , check each character for the range 48 to 57.

To count Vowels (a , e , i , o , u ) check each character with ascii code of every vowel.

And To count spaces, check character for ascii code 32.

C Program To Count Vowel Characters from String

You can download code : C-program-Count-Uppercase-Lowercase-constants-vowels-from-String.c (69 downloads)









Related Tutorials :
Conditional Statements , Loops in C Programs , Programs on Nested Looping & String-Arrays