I cant seem to figure out why my sort isnt working, its fine until it actually swops an element then its comparing the wrong elements, any suggestions?
1 2 3 4 5 6 7 8 9 10 11 12 13
for (int index = 0; index < numItems - 1; index ++)
{
for (int index2 = index + 1; index2 < numItems; index2 ++)
{
if (_stricmp(itemArray[index]->GetSortValue(), itemArray[index2]->GetSortValue()) > 0)
{
ItemType* tempItem = itemArray[index2];
itemArray[index2] = itemArray[index];
itemArray[index] = itemArray[index2];
}
}
}
numItems is the ammount of items read into the array