Errors, bugs, questions - page 1438
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
P./S.: They are not initialised here:
and you can't see in the code that anything is assigned to them.
Although maybe their initialization is hidden somewhere in these:
lines of code you have hidden.
Exactly ))) There's no problem with them.
In general, it's kind of inconvenient to keep track of the size of a dynamic array all the time... You need to know how much it weighs. What's the point of it then? ....
In principle, this is understandable. The only thing I don't understand is why this array cannot be incremented automatically.
Why couldn't it be done that way? It's not my idea )))) That's exactly how I tried to use a dynamic array...
Plus I additionally have to save the index... Not good...
Who says you can't dynamically enlarge it?
Here to help you
We should do a help on how to use the help )))))))))))))))))))))
In principle, this is understandable. The only thing I don't understand is why this array cannot be incremented automatically.
Why couldn't it be done that way? It's not my idea )))) That's exactly how I tried to use a dynamic array...
Plus I additionally have to save the index... Not good...
I don't understand what you were trying to do in this code.
Here, sketched you a little example showing what dynamic arrays are for and how to use them.
I don't understand why this array cannot be incremented automatically.
This is, in principle, a simple example of how a dynamic array should normally be filled. I haven't written in C for a long time, I don't remember, but that's how arrays are filled in php! Everything is logical and understandable. If I add an element to an array (arr[] = x), the array is automatically expanded, and the element is added to the end of the array. And we don't have to stretch it out by ourselves, and we don't have to specify the element's index by ourselves. But here we have to make absolutely unnecessary movements:
the difference is obvious...
In my opinion, it's strange, to say the least ))))
This is, in principle, a simple example of how a dynamic array should normally be filled. I haven't written in C for a long time, I don't remember, but that's how arrays are filled in php! Everything is logical and understandable. If I add an element to an array (arr[] = x), the array is automatically expanded, and the element is added to the end of the array. And we don't have to stretch it out by ourselves, and we don't have to specify the element's index by ourselves. But here we have to make absolutely unnecessary movements:
the difference is obvious...
I find it strange, to say the least ))))
Who prevents us from using OOP and implementing similar syntax?
Because language developers were brought up on Syakh, it severely hinders MQL's transition from hardcore SI-style to popsy PHP/JS-like. In plebeian PHP one simply assigns a new value and the array adjusts its size automatically. MQL makes the coder feel its importance. So, take a shovel and enjoy being a member of the select few professionals.
"without the programmer's knowledge" does not work. It is the programmer who gives the command "add an element to the end of the array" (arr[] = x). And the array has no "independent decision rights". Only by executing the programmer's command does it increase its size, thus relieving the programmer from keeping track of that very size. )))
As my experience shows, if the programmer writes something into an array containing 10 items with index 20, it most likely means that he/she made a mistake, and the program should generate an error, but not increase the size of the array, thereby hiding a suspicious action.
All these "arrays that tweak the size" have far more problems with hiding potential errors than they do with convenience. What's more, and not having to keep track of the array size is also a potentially dangerous practice, leading to hard-to-fix bugs.