Why do you need global variables to do this?
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
Some other good keywords are "parsing" and "delimiter".
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
Your solution does have a logical error.
Here's what you can think of as an algorithm.
1. set pointer to start of array.
2. use strstr( ) to find the first instance of the word.
3. When the word is found, increment the counter and then the pointer should be then set to the next position to what has been returned from strstr( ).
4. Repeat this in the process (from 2-3) the pointer is set to NULL or 0.
You will realise that the first for loop is unnecessary in your code.
Sky Diploma
Practically a Posting Shark
865 posts since Mar 2008
Reputation Points: 673
Solved Threads: 131
@ AveBik Start a new thread with your code you have so far and what is wrong with it plus all relevant error codes.
NathanOliver
Veteran Poster
1,084 posts since Apr 2009
Reputation Points: 215
Solved Threads: 189