C Program to find SubString in a given String



#include<stdio.h>
#include<conio.h>
void main()
{
char a[30],b[30];
int i,j,l1,l2,c,f;
clrscr();
printf("OUTPUT\n");
printf("------\n");
printf("\n\n");
printf("\nEnter First String:");
scanf("%s",a);
printf("\nEnter String to Search:");
scanf("%s",b);
l1=strlen(a);
l2=strlen(b);
j=0;
c=0;
f=0;
for(i=0;i<l1;i++)
{
x:
if(b[j]==a[i])
{
c++;
f=1;
j++;
if(c==l2)goto y;
}
else
{
if(f==1)
{
j=0;
c=0;
f=0;
goto x;
}
}
}
y:
if(c==l2)
printf("\n\t\tWord Found");
else
printf("\n\t\tWord Not Found");
getch();
}