#include <stdio.h>
#include <stdlib.h>
void main()
{
int i,j,d=0,k;
char a[30],b;
printf("enter the string: ");
fgets(a,sizeof(a),stdin);
printf("enter the first character to be searched and printed: ");
scanf("%c",b);
for(i=0;a[i]!=32;i++)
{
if(b==a[i])
{
printf("%c",a[i]);
}
}
for(i=0;a[i]!='\0';i++)
{
if(a[i]==32)
{
i++;
k=i;
if(b==a[i])
{
for(k=i;a[k]!==32;k++)
{
printf("%c",a[k]);
}
}
}
}
}
error at line 29 and 36
output should be like this
enter the string: i love cricket
enter the chcarcter:c
output is cricket