Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- #define LINE 1024
- void create(void);
- void check(char *);
- void processing(void);
- void out(void);
- struct text
- {
- char *word;
- int delete;
- struct text *next;
- } *start = NULL;
- int main()
- {
- create();
- processing();
- out();
- return 0;
- }
- void create(void)
- {
- char string[LINE];
- struct text *p;
- while (scanf("%s", string) != EOF)
- {
- p = malloc(sizeof(struct text));
- if (p == NULL)
- {
- printf("Ошибка! Память не выделена!");
- exit (3);
- }
- check(string);
- p -> word = malloc(strlen(string) * sizeof(char));
- strcpy(p -> word, string);
- p -> next = start;
- start = p;
- }
- return;
- }
- void check(char *string)
- {
- struct text *t = malloc(sizeof(struct text));
- char c = string[0];
- if (c == toupper(c))
- t -> delete = 1;
- return;
- }
- void processing(void)
- {
- struct text *p;
- for (p = start; p != NULL; p = p -> next)
- if ((p -> delete) == 1)
- {
- putchar('1');
- free(p -> word);
- printf("ОСВОБОЖДЕНА ПАМЯТЬ");
- }
- return;
- }
- void out(void)
- {
- struct text *p;
- for (p = start; p != NULL; p = p -> next)
- printf("%s\n", p -> word);
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement