Hi guys,
Example: I have 1 array ArrayTest [10] [10000] and I need move whole 4th row to 2nd line (rewrite data inside array)
My code:
exist some better way? Main parameter for me is speed operations.
Is possible move whole row inside array? Thank you.
- Don't worry about speed, until you can prove that is the bottle neck.
- Instead of moving data, just remember that row 2 is available and reuse later. Either a sentinel value, or add an index to the next row (pointers)
WHRoeder:
Ok, I want move data becose 1) old row 2 I do not need 2) array will grew (I will insert new actual data therefore I want unnecessary data rewrite)
I would have test larger and larger array..
Is possible move whole row inside array? Thank you.
Yes. Use ArrayCopy().
Here is an example:
double ArrayTest[10][5]; ArrayTest[4][0] = 9; ArrayTest[4][1] = 8; ArrayTest[4][2] = 7; ArrayTest[4][3] = 6; ArrayTest[4][4] = 5; ArrayCopy(ArrayTest, ArrayTest, 10, 20, 5); Print (ArrayTest[2][3]);
The above code copies the fifth row (remember, arrays are zero-based) to the third row (any data in the third row will be overwritten by the data in the fifth row).
Thirteen: Thanks
Codersguru: no FIFO princip
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
Example: I have 1 array ArrayTest [10] [10000] and I need move whole 4th row to 2nd line (rewrite data inside array)
My code:
exist some better way? Main parameter for me is speed operations.
Is possible move whole row inside array? Thank you.