Array declaration

 
int array[OrdersTotal() ];
Why can't I declare like above ?
 
dahumeovn:
Why can't I declare like above ?

You cannot,  instead use ArrayResize()

 

int array[];

ArrayResize(array, OrdersTotal() );
 
dahumeovn:
Why can't I declare like above ?

I believe an array's elements must be literally declared at compile time, rather than simply at runtime.  

The following generates a compile error...

int x = 1;
int array[x];

however, the following does not:

int x = 1;
int array[];
ArrayResize(array, x);

So, as RaptorUK suggested:

int array[];
ArrayResize(array, OrdersTotal());
Reason: