Ive got function that shifts array by 1 index to right:
void arrayShiftRight(int array[], int size) {
int temp = array[size - 1];
for ( int i = size; i > 0; i-- ) {
array[i] = array[i - 1];
}
array[0] = array[temp];
}
the input is 0 1 2 3 4 5 6
the output is 5 0 1 2 3 4 5
I can't understand why array[temp] becomes 5 instead of 6.