User Tools

Site Tools


programming-languages:mql:array

Array

Array objects can be of two types:

  • static: its dimensions have a fixed size
    double arr_static[4][2] = {};
  • dynamic: its first dimension has no fixed size
    double arr_dynamic[][2] = {};

An array can be passed to a function only by reference and can only be of dynamic type:

  1. void OnStart() {
  2. double arr_a[] = {};
  3. double arr_b[][2] = {};
  4. double arr_c[4][2] = {};
  5.  
  6. function(arr_a, arr_b, arr_c);
  7. }
  8.  
  9. void function(double &arr_a[], double &arr_b[][2], double &arr_c[][2]) {
  10. Print("size ", ArraySize(arr_a)); // size 0
  11. Print("size ", ArraySize(arr_b)); // size 0
  12. Print("size ", ArraySize(arr_c)); // size 8
  13. }
programming-languages/mql/array.txt · Last modified: 2023/09/01 08:41 by tormec