Hello,
Im wondering why my data in 'intFront' does not stay the same. Im shifting the elements in my array left:
void stack::rotate(int nRotations)
{
for (; nRotations > 0 ;) // Number of Rotations to the left
{
intFront = &items[top+1].n;
for ( int shiftL = 0; shiftL < count-1; shiftL++ )
{
items[shiftL] = items[shiftL+1]; // shift left from the front
}
items[count-1].n = *intFront;
nRotations--; // decrement=0 will indicate no more rotations left
}
}
Whats happening is that the first value or "head" or "front" of the array is put into a varaible 'intFront'. I rotate everything left by the given number of rotations, hoping to just make a simple transfer at the end. Guess not..