PatchworkOS
Loading...
Searching...
No Matches
strstr.c
Go to the documentation of this file.
1
#include <
string.h
>
2
3
char
*
strstr
(
const
char
* s1,
const
char
* s2)
4
{
5
const
char
* p1 = s1;
6
const
char
* p2;
7
8
while
(*s1)
9
{
10
p2 = s2;
11
12
while
(*p2 && (*p1 == *p2))
13
{
14
++p1;
15
++p2;
16
}
17
18
if
(!*p2)
19
{
20
return
(
char
*)s1;
21
}
22
23
++s1;
24
p1 = s1;
25
}
26
27
return
NULL
;
28
}
NULL
#define NULL
Pointer error value.
Definition
NULL.h:23
string.h
strstr
char * strstr(const char *s1, const char *s2)
Definition
strstr.c:3
src
libstd
functions
string
strstr.c
Generated by
1.9.8