Theory
Write a C program to find length of a string.
#include
#include
#include
void main()
{
char str[100], word[20], mx[20], mn[20], c;
int i = 0, j = 0, flg = 0;
printf("\n\nFind the largest and smallest word in a string :\n");
printf("Input the string : ");
i = 0;
do
{
fflush(stdin);
c = getchar();
str[i++] = c;
} while (c != '\n');
str[i - 1] = '\0';
for (i = 0; i < strlen(str); i++)
{
while (i < strlen(str) && !isspace(str[i]) && isalnum(str[i]))
{
word[j++] = str[i++];
}
if (j != 0)
{
word[j] = '\0';
if (!flg)
{
flg = !flg;
strcpy(mx, word);
strcpy(mn, word);
}
if (strlen(word) > strlen(mx))
{
strcpy(mx, word);
}
if (strlen(word) < strlen(mn))
{
strcpy(mn, word.... Show MoreFrom Strings in C programming · C programming
Write a C program to find length of a string.
Write a C program to search all occurrences of a character in a string.
Write a C program to find maximum occurring character in a string.
Write a C program to count occurrences of a word in a given string.
Write a C program to copy one string to another string.
Write a C program to find total number of vowels and consonants in a string.
Write a C program to compare two strings
Write a C program to concatenate two strings.