Wednesday, February 11, 2015

C C Program to Find Substring in String Pattern Matching

Pattern matching refers to find the position where a string pattern appears in a given string. If the requird string is not present in given text, then it returns the value zero.

If the required string is present in a given string, it returns the position of occurrence of required string or substring.

Also Read: C program to concatenate two strings without using strcat() function


C Program


#include<stdio.h>

int main()
{
int i,j,temp;
char str[100]={"This is a pattern matching"};
char substr[20]={"pattern"};

for(i=0;str[i]!=

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.