トップ  >  MQL4リファレンス  >  配列関数  >  ArraySize
スポンサーリンク
検索

↑の検索エンジンが表示されない人は、
↓の古い検索エンジンを使用して下さい。
カスタム検索
MQL4リファレンスツリー
ArraySize


ArraySize


配列の要素数を返します。

関数書式:
int  ArraySize(
    const void&  array[]    // チェックする配列
   );



■引数
引数名 初期値 I/O 詳細
array[] - In チェックする配列


■戻り値
要素数を返します


■備考
無し


サンプルソース:
#property strict // strictは絶対に削除しない事

//+------------------------------------------------------------------+
//| プログラムスタート
//+------------------------------------------------------------------+
void OnStart(){
    double four_dim[2][2][2][2];

    Print("配列サイズ:", ArraySize(four_dim));

    // 結果
    // 配列サイズ:16
}






サンプルソース:
#property strict // strictは絶対に削除しない事

//+------------------------------------------------------------------+
//| プログラムスタート
//+------------------------------------------------------------------+
void OnStart(){

   int test_array[10];                       // テスト配列

   ArrayInitialize( test_array , 0 );        // 配列を初期化

   int array_size = ArraySize( test_array ); // 配列サイズ取得

   test_array[array_size - 1] = 99;          // 最後の配列に値を設定

   for( int icount = 0; icount < array_size; icount++ ) {
      printf( "test_array[%d]=%d" , icount, test_array[icount] );
   }

}


結果:
test_array[0]=0
test_array[1]=0
test_array[2]=0
test_array[3]=0
test_array[4]=0
test_array[5]=0
test_array[6]=0
test_array[7]=0
test_array[8]=0
test_array[9]=99





スポンサーリンク
スポンサーリンク


Copyright ©2015 MT4でEA自作しちゃお~ All Rights Reserved.


Top

inserted by FC2 system