C Programming String Example Programs
C Programming String Example Programs
Characters in a String
This program asks user to enter a string and a character and this program checks how
many times that character is repeated in the string entered by user.
Frequency of e = 4
C Program to Find the Number of Vowels,
Consonants, Digits and White space in a
String
This program takes a string from user and finds the total number of vowels, consonants,
digits and white space present in that string.
Vowels: 9
Consonants: 18
Digits: 1
White spaces: 5
C Program to Find the Length of a String
You can use standard library function strlen() to find the length of a string but, this program
computes the length of a string manually without using strlen() funtion.
Length of string: 9
This program asks user to enter a string and computes the length of string manually
using for loop .
C Program to Concatenate Two Strings
You can concatenate two strings easily using standard library function strcat() but, this
program concatenates two strings manually without using strcat() function.
This program takes a string from user and for loop executed until all characters of string is
checked. If any character inside a string is not a alphabet, all characters after it including
null character is shifted by 1 position backwards.
C Program to Sort Elements in
Lexicographical Order (Dictionary Order)
This program takes 10 words from user and sorts elements in lexicographical order. To
perform this task, two dimensional string is used.
Enter 10 words:
fortran
java
perl
python
php
javascript
c
cpp
ruby
csharp
In lexicographical order:
cpp
csharp
fortran
java
javascript
perl
php
python
ruby