I am trying to shift an array of 30 elements through an array of 6 elements and am running into a mental road block as how to accomplish this.
for example.
These are global arrays.
int counter[6] = {42,42,42,42,42,42};
int helper[30] = {1,2,3,4,5,42,42,42,5,4,3,2,1,42,42,1,2,3,4,7,42,42,42,42,4,2,6,2,5,9};
so for every shift the array would look like this
initial state: counter[] = {42,42,42,42,42,42};
state 1: counter[] = {42,42,42,42,42,1};
state 2: counter[] = {42,42,42,42,1,2};
state 3: counter[] = {42,42,42,1,2,3};
state 4: counter[] = {42,42,1,2,3,4};
state 5: counter[] = {42,1,2,3,4,5};
state 6: counter[] = {1,2,3,4,5,42};
state 6: counter[] = {2,3,4,5,42,42};
.
.
.
state n: counter[] = {4,2,6,2,5,9};
It should keep shifting till it got to the last element in helper[] then start shifting again from the beginning of helper;
Any help will be greatly appreciated.