Download MetaTrader 5

Minimum to dynamic array?

To add comments, please log in or register
Ade Bijon
20
Ade Bijon  

I was wondering whether there is a minimal amount of elements a dynamic array must have in order to work. This because I’d written a code which started by making a dynamic array of 10 elements and then it started reducing that number to 1. This did not work though, but when I changed the minimum of the dynamic array to 2 elements it did work for some reason. I still don’t really know why but could it be that a dynamic array can only be reduced up to a certain minimum, in this case 2  elements?

Keith Watford
Moderator
12226
Keith Watford  

For an array to be able to store data, it must have at least 1 element.

Possibly your are thinking that it needs a minimum of 2 because you are forgetting that the first element is accessed at DynamicArray[0]

To add comments, please log in or register