I have to find the count of a substring in a string using the C language.
I’m using the function strstr but it only finds the first occurrence.
My idea of the algorithm is something like searching in the string while strstr does not return null and
to substring the main string on each loop.
My question is how to do that?
You could do something like
That is, when you get a result, start searching again at the next position of the string.
strstr() doesn’t only work starting from the beginning of a string but from any position.