string array doesn't work for mql4
ywang2:
//I define the global array.
string m_symbols[FX_GOODS_MAXNUM];
//set the value:
for(int i=0; i<FX_GOODS_MAXNUM;i++)
{
m_symbols[i]="abc";
}
for(int i=0; i<FX_GOODS_MAXNUM;i++)
{
Alert(m_symbols[i]); //print the string array to check the value, nothing is printed
}
Can anyone help me to solve the problem; thanks
string m_symbols[FX_GOODS_MAXNUM];
//set the value:
for(int i=0; i<FX_GOODS_MAXNUM;i++)
{
m_symbols[i]="abc";
}
for(int i=0; i<FX_GOODS_MAXNUM;i++)
{
Alert(m_symbols[i]); //print the string array to check the value, nothing is printed
}
Can anyone help me to solve the problem; thanks
Try this instead:
int start(){ //I define the global array. int FX_GOODS_MAXNUM = 4; string m_symbols[]; // leave the array empty as you will add the elements with the loop below for(int i=0; i<FX_GOODS_MAXNUM;i++){ // add one element on each iteration of the loop m_symbols[i]="abc"; Print("element number: ",i," = ",m_symbols[i]); // print the result in the experts tab on the client terminal } return(0); }
oneday:
Try this instead:
Thanks, oneday.
It works.
string m_symbols[FX_GOODS_MAXNUM];
//set the value:
for(int i=0; i<FX_GOODS_MAXNUM;i++)
{
m_symbols[i]="abc";
}
for(int i=0; i<FX_GOODS_MAXNUM;i++)
{
Alert(m_symbols[i]); //print the string array to check the value, nothing is printed
}
Can anyone help me to solve the problem; thanks