my_list* reverse(my_list *list) { if(list == NULL) return NULL; my_list *pre = NULL,*cur = list->next,*nex = NULL; while(cur) { nex = cur->next; cur->next = pre; pre = cur; cur = nex; } return pre; }