Initialize a two-dimensional array

Weissnix
2019-10-21
2019-10-21
  • Weissnix - 2019-10-21

    Hello,

    you can initialize a one-dimensional array like this:

    arr1 : ARRAY [1..5] OF INT := [1,2,3,4,5];
    arr2 : ARRAY [1..2,3..4] OF INT := [1,3(7)]; (* short for 1,7,7,7 *)
    arr3 : ARRAY [1..2,2..3,3..4] OF INT := [2(0),4(4),2,3]; (* short for 0,0,4,4,4,4,2,3 *)
    Β 
    

    Now i would like to know if this is also possible for a two-dimensional array like this:

    arr1 : ARRAY [1..3] OF ARRAY [1..5] OF INT := [??];
    

    Maybe someone can give me a simple example?

    Thank you!

     
  • e.kislov - 2019-10-21

    Hi.
    Simpe example:

    arr1 : ARRAY [1..3] OF ARRAY [1..5] OF INT := [ [1, 2, 3, 4, 5], [11, 22, 33, 44, 55], [111, 222, 333, 444, 555] ];
    
     

Log in to post a comment.