C program to find largest word in a given string,C program to find longest word in a given string,program to find longest palindrome in a string in c,c program to find the occurrence of word in string
C program to find longest word in a given string
#include
#include
#include
void main()
{
char str[100];
int length,i,start=0,end=0,j;
int finalstart,finalend,count=0;
clrscr();
printf("Enter the string");
gets(str);
length=strlen(str);
for(i=0;i { j=i;
start=i;
while(str[j]!=' '&&str[j]!='\0')
{
end=j;
j++;
}
i=j;
if(count {
count=end-start;
finalstart=start;
finalend=end;
}
}
printf("\n longest word \n");
for(i=finalstart;i<=finalend;i++)
printf("%c",str[i]);
getch();
}
#include
#include
void main()
{
char str[100];
int length,i,start=0,end=0,j;
int finalstart,finalend,count=0;
clrscr();
printf("Enter the string");
gets(str);
length=strlen(str);
for(i=0;i
start=i;
while(str[j]!=' '&&str[j]!='\0')
{
end=j;
j++;
}
i=j;
if(count
count=end-start;
finalstart=start;
finalend=end;
}
}
printf("\n longest word \n");
for(i=finalstart;i<=finalend;i++)
printf("%c",str[i]);
getch();
}