Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

descending ordered list

Status
Not open for further replies.

chachi

Programmer
Joined
May 4, 2002
Messages
8
Location
US
The following code orders a linked list in ascending order:

Code:
while (currentPtr != NULL && value > currentPtr->data) {
      previousPtr = currentPtr;  
      currentPtr = currentPtr->nextPtr;
}

How might I alter this to sort descending?
 
To answer my own question, just change the greater than symbol to a lesser than symbol.
 
Status
Not open for further replies.

Similar threads

  • Locked
  • Question Question
Replies
2
Views
246
Replies
1
Views
210
Replies
5
Views
351
  • Locked
  • Question Question
Replies
1
Views
216

Part and Inventory Search

Sponsor

Back
Top