Sunday, 31 March 2013

string search


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char s[30],t[20];
char*found;
clrscr();
puts("enter the first string");
gets(s);
puts("enter the string to be sacrhed");
gets(t);
found=strstr(s,t);
if(found)
printf("secound string is found to be first string %d",found-s);
else
printf("-1");
getch();
}

No comments:

Post a Comment