I have a function that is supposed to reverse an array, but I get the same output back that went in. List going in is populated 1, 2,...18, 19, 20 and is supposed to return 20, 19, 18...2, 1. Instead I get another 1 - 20. Any help, tips or suggestions is greatly appreciated! Thanks in advance!
alist.reverse();
cout << "Reverse New List alist : " << endl;
cout << " " << alist << endl;
void List::reverse()
{
// Create temporary holder
List temp;
// Populate temp list with current list
for (int i = 0; i < Used; i++)
{
temp.MyAry[i]= MyAry[i];
}
// Repopulate current list
for (int j = Used - 1; j > - 1; j--)
{
MyAry[j] = temp.MyAry[j];
}
}