Question about array initialization

Raz A.

Aug 27, 2018
82 Posts

0  |  0  

Re: Question about array initialization

Assume that i have two arrays which their size is 4 - arr1,arr2

why CAN i do that:

arr1[0] = arr2[i]

but i CANNOT do that:
arr1 = {arr2[i],6,2,8}

i get "Compiler error #640: Expected constant...."

Solution Available
DrATEasy (Ron Y.)
Mission Viejo, CA

Aug 27, 2018
358 Posts

1  |  0  

Re: Question about array initialization

Only constants are acceptable as array literal expression (arr2[i] is not constant).

You can do:

arr1 = {0,2,8}

Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]