actually i haven’t yet figured out how it is in real code.
cirlist_node_count (circular_list a) node* tmp = pint->next; pint->next = NULL; list& pont = tmp;/* inheritance */ int count = get_linked_list_count(pont); get_tail_ref(pont)->next = tmp; pint = (circular_list)pont/* casting */
uh, it’s rather efficient to keep the address of head and count till the address repeats (i.e when we came to the head)
LikeLike