Initialize an array w variables.

 

Hi Everyone.

I am a newbie to arrays.

Is it possible to initialize an array with variables.

When I go:

int xxx[] = {1,2,3};

There is no problem, but if i go:

int xxx[] = {A,B,C}; it says

'}' -comma or semicolon expected.

What am I doing wrong?

Thanks

 
chingching:

There is no problem, but if i go:

int xxx[] = {A,B,C}; it says

'}' -comma or semicolon expected.

What am I doing wrong?

Thanks

try this

int xxx[] = {'A','B','C'}; 

See also /go?link=https://docs.mql4.dev/basis/variables/initialization

All arrays, including those declared in the local scope, can be initialized with constants only.

Reason: