109 int reverse_linklist(linklist head)
110 {
111 if (head == NULL)
112 {
113 printf("head of clear is NULL\n");
114 exit;
115 }
116 linklist p, q;
117 p = head->next;
118 head->next = NULL;
119 while (p!= NULL)
120 {
121 q = p;
122 p = p->next;
123 q->next = head->next;
124 head->next = q;
125 }
126 return 0;
127 }
110 {
111 if (head == NULL)
112 {
113 printf("head of clear is NULL\n");
114 exit;
115 }
116 linklist p, q;
117 p = head->next;
118 head->next = NULL;
119 while (p!= NULL)
120 {
121 q = p;
122 p = p->next;
123 q->next = head->next;
124 head->next = q;
125 }
126 return 0;
127 }