Strings are basically array of characters that represent some textual data in a program. Here are basic string programs with detailed explanation that will help to enhance your string programming skills. These exercises can be practiced by anyone a beginner or an intermediate programmers.
Required knowledge
Basic C programming, Array, Pointer, Functions, Strings
List of string programming exercises
- Write a C program to find length of a string.
- Write a C program to copy one string to another string.
- Write a C program to concatenate two strings.
- Write a C program to compare two strings.
- Write a C program to convert lowercase string to uppercase.
- Write a C program to convert uppercase string to lowercase.
- Write a C program to toggle case of each character of a string.
- Write a C program to find total number of alphabets, digits or special character in a string.
- Write a C program to count total number of vowels and consonants in a string.
- Write a C program to count total number of words in a string.
- Write a C program to find reverse of a string.
- Write a C program to check whether a string is palindrome or not.
- Write a C program to reverse order of words in a given string.
- Write a C program to find first occurrence of a character in a given string.
- Write a C program to find last occurrence of a character in a given string.
- Write a C program to search all occurrences of a character in given string.
- Write a C program to count occurrences of a character in given string.
- Write a C program to find highest frequency character in a string.
- Write a C program to find lowest frequency character in a string.
- Write a C program to count frequency of each character in a string.
- Write a C program to remove first occurrence of a character from string.
- Write a C program to remove last occurrence of a character from string.
- Write a C program to remove all occurrences of a character from string.
- Write a C program to remove all repeated characters from a given string.
- Write a C program to replace first occurrence of a character with another in a string.
- Write a C program to replace last occurrence of a character with another in a string.
- Write a C program to replace all occurrences of a character with another in a string.
- Write a C program to find first occurrence of a word in a given string.
- Write a C program to find last occurrence of a word in a given string.
- Write a C program to search all occurrences of a word in given string.
- Write a C program to count occurrences of a word in a given string.
- Write a C program to remove first occurrence of a word from string.
- Write a C program to remove last occurrence of a word in given string.
- Write a C program to remove all occurrence of a word in given string.
- Write a C program to trim leading white space characters from given string.
- Write a C program to trim trailing white space characters from given string.
- Write a C program to trim both leading and trailing white space characters from given string.
- Write a C program to remove all extra blank spaces from given string.