Similar to this: C# Array of Increments I've also looked at this: Getting a sub-array from an existing array
I calculate a sum to achieve my value from a position in my array, for instance I want to decode to a float position 502 in my byte array and increment the position by 2 so I would be looking at position 504, 506, 508 etc. a specified amount of time like 100 times (so 100 values). So I thought using a for loop may be best, please note I can retrieve the first value just need to get the rest. I need to step through and retrieve three different variables, not just the one.
I've seen this around (have never used it) and think the '+= 2' is the steps?
for (int i = 1; i < 100; i += 2) { }
At the moment I have something like (This just gets me the first value, no idea how to increment position)
int of2 = 502;
int of1 = 254;
int of3 = 750;
for (int i = 1; i < 100; i++)
{
float f1 = Decode(Rec, of1) / (float)100;
float f2 = Decode(Rec, of2) / (float)100;
float f3 = Decode(Rec, of3);
}
The end result should look like:-
Structure
(f1, f2, f3)
(f1, f2, f3)
(f1, f2, f3)