Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main(void)
- {
- char* str = "Hello, cacaworldca\n";
- char* str2 = str;
- int i, count = 0;
- for(i=0;i< strlen(str) -1;i++, str2++){
- if(strncmp(str2, "ca", 2) == 0){
- count++;
- }
- }
- printf("出現回数:%d\n",count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement