Question: Write the function numStr() in C++.The function has two parameters: a const char * s1 pointing to the first character in a C-style string, and

Write the function numStr() in C++.The function has two parameters: a const char * s1 pointing to the first character in a C-style string, and a const char * s2. Return the number of times that s2 appears inside s1. */

**You may not use ANY library functions or include any headers, except for for size_t. and for printing/testing.

Example:

Calling:

numStr("abaracadabara", "a"); prints 7. numStr("abaracadabara", "ab"); prints 2. numStr("abaracadabara", "bara"); prints 2 numStrK("abaracadabara", "cad"); prints 1 numStr("abaracadabara", "A"); prints 0

Please explain your steps. Thanks.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!