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 SkipVought 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
May 4, 2002
8
0
0
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.

Part and Inventory Search

Sponsor

Back
Top