Hello everybody
I have a programming question.
My array looks like this:
array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
And I want to erase from the array the elements like in a queue.
first modification: |1|2|3|4|5|6|7|8|9|
second modification: |2|3|4|5|6|7|8|9|0|
tird modification: |3|4|5|6|7|8|9|0|0|
fourth modification: |4|5|6|7|8|9|0|0|0|
...
Since now its easy:
array[i] = array[i+1];
But I have another boolean array that can lock in some numbers, for example:
bool lock[3] = {false, false, false};
I want that when lock[1] = true, the array[1] remains unchanged.
lock[1] = true;
first modification: |1|2|3|4|5|6|7|8|9|
second modification: |3|2|4|5|6|7|8|9|0|
tird modification: |4|2|5|6|7|8|9|0|0|
and so on..
How can be implemented in a easy manner?