Theory
Write a program in C to find the largest and smallest word in a string.
/** * C program to search all occurrences of a character in a string */ #include#define MAX_SIZE 100 // Maximum string size int main() { char str[MAX_SIZE]; char toSearch; int i; /* Input string and character to search from user */ printf("Enter any string: "); gets(str); printf("Enter any character to search: "); toSearch = getchar(); /* Run loop till the last character of string */ i=0; while(str[i]!='\0') { /* If character is found in string */ if(str[i] == toSearch) { printf("'%c' is found at index %d\n", toSearch, i); } i++; } return 0; }
From Strings in C programming · C programming
Write a program in C to find the largest and smallest word in a string.
Write a C program to compare two strings
Write a C program to copy one string to another string.
Write a C program to find maximum occurring character in a string.
Write a C program to find total number of vowels and consonants in a string.
Write a C program to count occurrences of a word in a given string.
Write a C program to concatenate two strings.
Write a C program to find length of a string.