From the documentation on Initialization of variables:
"The list of array elements values must be enclosed in braces. Initializing values omitted are considered as equal to 0. If the initializing array size is not defined, it will be defined by the compiler from the szie of the initializing sequence. Multidimensional arrays are initialized by a one-dimensional sequence, i.e. sequence without additional braces. All arrays, including those declared in the local scope, can be initialized with constants only."
string test[] = {"hello", "sir"};
or
string test[2]; test[0] = "hello"; test[1] = "sir";
You can also use ArrayResize() to resize the first dimension of an array after it has been declared/initialized.
I see. Thank you.
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
How do I assign a variable into an array (if even possible)?
The most obvious way doesn't work.