You need to specify the size.
void start(){ double a[3]; a[1]=1.0; a[2]=2.0; Alert("a1: "+a[1]); Alert("a2: "+a[2]); }
Thanks for your prompt answer, actually i have problems to declare the array size:
extern int arrayNumber=3;
void start() {
double a[arrayNumber];
a[1]=1.0;
a[2]=2.0;
Alert("a1: "+a[1]);
Alert("a2: "+a[2]);
}
it only works when i specify the array size with actual number instead of passing an integer variable...how can i solve this problem?
If you need to change the size of an array use . . .
ArrayResize( object&array[], int new_size)
extern int arrayNumber=3; void start() { double a[1]; ArrayResize( a, arrayNumber ); a[1]=1.0; a[2]=2.0; Alert("a1: "+a[1]); Alert("a2: "+a[2]); }
thanks for your advice...it works

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
my code:
double a[];
a[1]=1.0;
a[2]=2.0;
Print("a1: "+a[1]);
Print("a2: "+a[2]);
it shows a1: 0.000000000000000 and a2: 0.000000000000000...
what's wrong with the code? i was expected to have a1: 1.0 and a2: 2.0...