This is the code

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
int i,p=0,d=0;
char a[100],sub[10],b[10];
printf("Enter the main string \n");
gets(a);
printf("Enter the substring \n");
gets(sub);
strcat(a," ");
for(i=0;i<strlen(a);i++)
{
if(a[i]==' ')
{
if(strcmp(b,sub)==0)
{
printf("yes \n");
p=i+1;
break;
}
strcpy(b, "");
d=0;
}
else
{
b[d]=a[i];
d+=1;
}
}
printf("Substring found at position %d",p);
}

theres some error in the output,kindly help me in rectifying the same.