Showing posts with label substring. Show all posts
Showing posts with label substring. Show all posts

20130426

How to search a substring in C++/Cpp without using library function strstr


/*How to search a sub string without using library function strstr. 
How to use pointer/array to search substring in a string sentence.
C++/CPP/C program/code to search a word in a sentence without using inbuilt function strstr*/
#include<stdio.h>
#include<string.h>
int main()
{
char arr1[50];
printf("Enter a String:\n");
scanf("%s",&arr1);

char arr2[20];
printf("Enter a String:\n");
scanf("%s",&arr2);
printf("Searching for:%s\n",arr2);