Home > Back-end >  c
c

Time:09-23

An English article has 1000 words, is stored in the char article [1000], write programs to find out the word "test", the number of occurrences of

CodePudding user response:

You can use the string matching, reference post

https://blog.csdn.net/zhanghaiyang9999/article/details/40709247

CodePudding user response:

Since the original poster is matching words, remember the long words contained test out,
Can consider to use strtok, use a reference to an https://baike.baidu.com/item/strtok/5522728? Fr=Aladdin
As long as the Spaces, commas, periods, such as sign out, such as
Strtok (article, ", ")

CodePudding user response:

The most common trival, define two pointer, a pointer to the article, a pointer to the pointer, traverse the general word, and then the second pointer to the first, and figure out whether characters were the same as the test at a time