Monday, December 26, 2011
8:20 PM

C Program to find position of sub-string in a String


Program to find position of sub-string in a String






#include#include
void main(){char str[20] , pat[20] ;int i=0,j,k=0 ;printf("enter the first string :");gets(str); // input main string
printf("\nenter the 2nd string : ");gets(pat); //input sub-string or pattern

while(str[i]!='\0') {//if first character matches if(str[i]==pat[0]) { j=1;//if next character of

0 comments:

Post a Comment