contributed by m64466805
m64466805
list_tail()
這邊使用間接指標做操作,函式目標是找到串列的尾端節點,因此不斷將指標往後更新,故此處的AAAA 是 *left->next
AAAA
*left->next
while ((*left) && (*left)->next) - left = &(AAAA); + left = &((*left)->next); return *left;
list_length()
這邊同樣使用間接指標做操作,函式走訪每個節點,並記錄長度,因指標需要不斷往後更新,故此處的BBBB 也是 *left->next
BBBB
while (*left) { ++n; - left = &(BBBB); + left = *left->next; } return n;
quick_sort()
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up