0
Why am i not getting correct output please help
The program is to print largest word from string https://code.sololearn.com/cj0lBTU1x6ZF/?ref=app
8 odpowiedzi
+ 1
Answer please
+ 1
One of your error is on the 14th line. You need to increase the variable i inside the while loop.
0
Do you have to implement this manually? I can suggest you to use `strtok` function for this. But if you were to make your own implementation, then it's a no good idea.
0
Can you please send a full solution
0
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char a[50],b[20],c[20];
int i,j=0,l=0;
printf("Enter a string:\n");
gets(a);
for(i=0;i<=strlen(a);i++)
{
if(a[i]!=32 && a[i]!='\0')
b[j++]=a[i];
else
{
b[j]='\0';
if(strlen(b)>l)
{
strcpy(c,b);
l=strlen(b);
}
j=0;
}
}
printf("The longest word is:");
puts(c);
getch();
}
0
Thankyou
so much
0
You can examine this code and ask me what you dont understands.
0
Ok