Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ctype.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include "push.h"
- int main()
- {
- int count;
- int i;
- int size;
- char word;
- printf("input the malloc size: ");
- scanf("%d", &size);
- char *str = (char*)malloc(sizeof(char) * (size+1));
- stack_node_t nodes;
- init(&nodes);
- printf("you want to show the word and time\n");
- scanf("%s", str);
- while(*str != '\0')
- {
- if(isalpha(*str))
- {
- word = *str;
- }
- else
- {
- count = atoi(str);
- for(i = 0 ; i < count; i++)
- {
- stack_node_insert(&nodes, word);
- }
- }
- str++;
- }
- stack_printlist(&nodes);
- stack_node_all_delete(&nodes);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement