How does strstr() work?

2015-01-04 Thread Jody Bruchon
I was looking at the code for strstr(s1, s2) and I do not understand how it does what it's supposed to do. The only exit points return NULL or the original pointer to s1. How does strstr() return the pointer to the substring it's supposed to be looking for? _

Re: How does strstr() work?

2015-01-04 Thread Yann E. MORIN
Jody, All, On 2015-01-04 10:04 -0500, Jody Bruchon spake thusly: > I was looking at the code for strstr(s1, s2) and I do not understand how it > does what it's supposed to do. The only exit points return NULL or the > original pointer to s1. How does strstr() return the pointer to the > substring