Pattern matching in C: C program to check if a string is present in an another string, for example, the string "programming" is present in the string "C programming". If it's present, then its location (i.e. at which position it's present) is printed. We create a function match which receives two character arrays and returns the position if matching occurs otherwise returns -1. We are implementing naive string search algorithm in this program.
Output of program:
Enter sume text:
computer programming is fun
Enter a string to find
programming is fun
Found at location 10