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
Task: remove an element from an array.
Task: remove an element from an array.
One-dimensional or two-dimensional. The tasks have different answers because you won't make the same code for both. Or rather you may do it, but you won't be able to call it without knowing beforehand the number of measurements in the array. Since you are not a programmer, judging by your words, I suggest that you take it on faith
Arrays cannot have more than 4 dimensions here. So, you can write 4 different functions and that's it.
Can't you build an 8-dimensional one?
If we look at the problem this way, then multidimensional arrays should not be declared at all - arrays of structures with different fields should be used instead. But the question is different - what can we do with an array of arbitrary (unknown in advance) dimensionality that already exists as a given
What's not to like about the multiple function option?
By having to duplicate the same code (the same one you're talking about), in functions with different names for each different dimensionality of the parameter array
Arrays don't have more than 4 dimensions here. So, you can write 4 different functions and that's it.
The problem is not in writing 4 functions, but in not being able to use one for any array, as is the case with any other types. That's why it's better to avoid using multidimensional arrays (built-in type []) in µl at all
Can't you make an 8-dimensional one?
The structures are easy to use.
Eh, and overloading doesn't save it:
Will it compile like this?
Although I don't remember exactly, but it seems that the second and next measurements cannot be dynamic. Correspondingly, there may be errors when compiling such code. Here, the size_second_dimension variable can be used as a set size of the second dimension and allow to overload the function. Plus, it avoids the need to define the dimensionality through ArrayRange()Will it compile like this?
Although I do not remember exactly, it seems the second and the next measurements cannot be dynamic. Correspondingly, there may be errors in compilation of such code. Here size_second_dimension variable can be used as the predefined size of the second dimension and allows to overload the function. Plus, it avoids the need to define the dimensionality through ArrayRange()It will compile, but it's not interesting, and what about z[][][]?
The second and above measurements cannot be dynamic, but the function doesn't have to be customised for a particular size of the second dimension, it can be found out through ArrayRange().
If the number of measurements won't allow to overload the function, the size of the second and other measurements certainly won't. Besides, it's not interesting at all, since it is not universal at all. It would be easier to write functions with different names.