/** * @brief 主函数 * @return 若成功,则返回EXIT_SUCCESS,否则返回EXIT_FAILURE */ int main(void) { // 储存最近一次scanf读入的数据 static char current_word[MAX_LENGTH]; // 链表的头节点 LinkList * head = NULL; // 定位指定单词的节点 LinkList * pos = NULL; while ( scanf("%100s", current_word) != EOF ) { if ( (pos = locate(head, current_word)) != NULL ) increase(pos); else { if ( !append(&head, current_word) ) { fprintf(stderr, "No sufficient memory!!!\n"); abort(); } } } outputStatistic(head); destroyLinkList(&head); return EXIT_SUCCESS; }
CircularLinkList::~CircularLinkList() { destroyLinkList(current); current = NULL; }