Array how work it ??

 

hi guy

i  try tounderstund  how  use  Array  , i created a  simply  script 

in this  script  i want  insert  a seconds  in  Array and  after print it  , but not  work :D  some one canhelp me ?? thankz


//+------------------------------------------------------------------+
//|                                                         test.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
#include <stderror.mqh>
#include <stdlib.mqh>
int p,n,TotalSymbols,MAX=0;
int de=61;
int m=TimeSeconds(TimeCurrent());
int aTimer[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   ArrayResize(aTimer,de+1);
   ArrayInitialize(aTimer,EMPTY_VALUE);
   for(int h=0;h==de;h++)
     {
      aTimer[h]=TimeSeconds(TimeCurrent());
      printf("array[%d] = %G",h,aTimer[h]);
     }

   for(int G=0;G==de;G++)
     {
      int temp=ArrayRange(aTimer,G);
      //--- print
      PrintFormat("dim = %d, range = %d",G,temp);
       
     }
     
  }
//+------------------------------------------------------------------+
 
   for(int h=0;h==de;h++)

you probably mean

   for(int h=0;h<de;h++)


   for(int G=0;G==de;G++)
     {
      int temp=ArrayRange(aTimer,G);
      //--- print
      PrintFormat("dim = %d, range = %d",G,temp);
       
     }

I have no idea what you are trying to achieve here

The array is single dimensional, so there is no point in trying to retrieve the size of dimensions that don't exist

 

thankz  GumRai the second  for   ,  want  only print  a array  content  ,  how  is possible to do ???

 
faustf:

thankz  GumRai the second  for   ,  want  only print  a array  content  ,  how  is possible to do ???


Sorry, I still have no idea what you are trying to do.

Maybe you don't know what ArrayRange() returns? and think that it does something else?

 

i want  to do:

take  time

insert  in array

display  the array

yea probably Arrayrange is not correct

, because  return a elements , and i want a content ,  but  how  is possible  display a content of  array ???

 
You have already coded a loop to assign values to the array so it is a simple matter to write the same loop but instead of assigning values to the array, you retrieve them.
Reason: