How can I save the address of the structure that is in front of the minimum element?
The list is simply connected!
Here is the function:
Single_List Find_Min_Elem(Single_List* Head) { //элементы списка(к примеру): 7 5 9 3 1 5 Single_List *temp = Head; Single_List *temp2 = temp->Next; Single_List *preMin= temp;//адрес предыдущего элемента миним //структуры(нужен для того, чтобы не потерять) for (int i = 0;i < 5; i++) { if ((temp->Data) < (temp2->Data)) { temp2 = (temp2->Next); }//end if else { temp = temp2; temp2 = (temp2->Next); }//else }//for return *preMin; }
Where should I use premin?