Skip to content

Instantly share code, notes, and snippets.

@dd1994
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dd1994/10573983 to your computer and use it in GitHub Desktop.
Save dd1994/10573983 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
void func(char *, char *);
int main(void)
{
char str1[80], str2[80];
gets(str1);
gets(str2);
func(str1, str2);
return 0;
}
void func(char *str1, char *str2)
{
int i, j, flag;
int m = strlen(str1);
int n = strlen(str2);
for (i = 0; i < m; ++i)
{
if (str1[i] == str2[0])
{
for(j = 1, flag = 1; j < n ; j++)
{
if (str1[i + j] != str2[j])
{
flag = 0;
break;
}
}
if (1 == flag)
{
i = i + j;
}
}
printf("%c", str1[i]);
}
}
@dd1994
Copy link
Author

dd1994 commented Apr 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment