C string examples
C Programs - String
Practice C programs based on strings, character arrays, null termination, frequency, replacement, trimming, and word operations.
Topic library
32
practice programs
Topic overview
String is one of the most frequently used data structures in programming.
In C, a string is a sequence of characters stored in a character array and terminated with the null character \0.
These programs help you practice input, traversal, frequency counting, character replacement, word search, trimming, and removing duplicates.
Practice list
String programs in C
- 1C Program to take string as an input
- 2C Program to find length of a string
- 3C Program to copy one string to another string
- 4C Program to concatenate two strings
- 5C Program to convert lowercase string to uppercase
- 6C Program to convert uppercase string to lowercase
- 7C Program to toggle case of a string
- 8C Program to count alphabets, digits and special characters in a string
- 9C Program to count number of vowels and consonants in a string
- 10C program to count number of words in a string
- 11C program to find reverse of a string
- 12C Program to check if a string is a palindrome
- 13C program to find first occurrence of a character in a string
- 14C program to find last occurrence of a character in a string
- 15C program to search all occurrences of a character in a string
- 16C program to find highest frequency character in a string
- 17C program to find lowest frequency character in a string
- 18C program to count frequency of each character in a string
- 19C program to remove first occurrence of a character from string
- 20C program to remove last occurrence of a character from string
- 21C program to remove all occurrences of a character from string
- 22C program to remove all repeated characters from a given string
- 23C Program to replace first occurrence of a character in a string
- 24C Program to replace last occurrence of a character in a string
- 25C program to replace all occurrences of a character in a string
- 26C program to find first occurrence of a word in a string
- 27C program to search all occurrences of a word in a string
- 28C program to remove first occurrence of a word from string
- 29C program to remove last occurrence of a word from string
- 30C program to remove all occurrence of a word from string
- 31C program to trim leading and trailing white spaces from string
- 32C program to remove all extra blank spaces from string