I am designing a Unsorted List Class, right now its static (no pointers) - later it will be converted into dynamic.
One of the member functions is: DeleteItem and it gets passed a location. This function deletes an item in the array, and then has to move all the existing elements down in the array.
I was just wondering if my code below makes scense, any input to improve would be greatly appreciated.
Also 'end' keeps track where the current end of array is.
void GList::DeleteItem(int loc)
if(loc - 1 > end)
if(loc - 1 == end)
list[loc - 1] = -1
if(loc - 1 < end)
temp = end - (loc - 1);
for(int i = 0; i < temp; i++)
list[loc - 1] = list[loc];