I have an array with the following values and a variable set to 0 that increases upon added bytes to the array:
data = [0, 0, 0]
position = 0
I add a byte to the array:
data[position++] = 1
Which now is:
data = [1, 0, 0]
position = 1
My issue: Where 1 is in the array, the position of that byte is 0, but my position is 1. How can I set the position of that byte to 1?
So I can get it like this:
data[position] <- Returns **1** -> data[1]
Now, when I use data[position]
, it returns 0