Dynamic Array declaration
Try array resize after you have declared the array, there is a section in the Documentation all about Arrays . . .
desert:
Hi,
I would need to define the size of my array by an external variable, is that possible?
Yes.
extern int size=100; double orders[]; // an empty array, a pointer to nowhere. bool abort=false; int val=0; //------------------------------------------------------------------------------------ int init(){ val = ArrayResize(orders,size); // allocate memory to the array so the pointer is no longer null. if( val<0 ){ abort=true; Comment("It didn't work"); return(0); } return(0); } //------------------------------------------------------------------------------------ int start(){ if( abort ) return( 0 ); Comment("Success! " + val); return(0); }
Thanks guys
Hi,
I would need to define the size of my array by an external variable, is that possible? Example:
external int Size;
...
double Orders[Size];
When compiling it fails on the array declaration: "integer number expected"
Thanks in advance!