Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <mm_malloc.h>
- int main() {
- int length = 0, counter = 0;
- char* str;
- //char* str_res;
- puts("Input word length: ");
- scanf("%d", &length);
- str = (char*)malloc(length * sizeof(char));
- //str_res = (char*)malloc(length * sizeof(char));
- for(int i = 0; i <= length; i++){
- scanf("%c", &str[i]);
- }
- for(int i = 0; i <= length; i++){
- if(strcmp(str + i, "ed")){
- counter++;
- }
- }
- printf("C: %d", counter);
- return 0;
- }
- /*
- Input word length:
- 5
- edaed
- C: 5 - это не верно
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement