reverse list

typedef struct list_node
{
	int data;
	struct list_node * next;
}LIST_NODE;

struct list_node * list_reverse(list_node *head)
{
	struct list_node * new_head = NULL;
	while(head)
	{
			struct list_node * tmp = head;
			head = head->next;
			tmp->next = new_head;
			new_head->next = tmp;
	}
	return new_head;
}

發佈了36 篇原創文章 · 獲贊 5 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章