Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- char str[1000];
- printf("Enter the text\n");
- fflush(stdin);
- fgets(str, sizeof(str), stdin);
- // создание массива слов
- char **words = NULL, *p = NULL;
- int i, cnt = 0;
- for (p = strtok(str, " "); p != NULL; p = strtok(NULL, " ")) {
- if ((words = (char **) realloc(words, sizeof(char *) * (cnt + 1))) == NULL) {
- printf("No memory to new word!\n");
- exit(1);
- }
- if ((words[cnt] = strdup(p)) == NULL) {
- printf("Can't duplicate word!\n");
- exit(1);
- }
- ++cnt;
- }
- // подсчет гласных в словах
- for (i = 0; i < cnt; ++i) {
- if (count_of_vowels(words[i]) < 3) printf("%s ", words[i]);
- }
- for (i = 0; i < cnt; ++i) {
- if (words[i] != NULL) {
- free(words[i]);
- words[i] = NULL;
- }
- }
- free(words);
- words = NULL;
- printf("\n\n");*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement