Is there way of copying the whole array into another array? e.g. If the arrays are of the same type and fixed (not dynamic) size then you can copy by simply assigning one to the other (array1 := array2) |
Smart pascal source code
var a, b: array [0..2] of Integer; begin b := [1, 2, 3]; a := b; Writeln(Length(a)); // 3 Writeln(a[0]); // 1 Writeln(a[1]); // 2 Writeln(a[2]); // 3 b[1] := 0; Writeln(a[0]); // 1 Writeln(a[1]); // 2 Writeln(a[2]); // 3 a := [4, 5, 6]; WriteLn('-------------------'); Writeln(a[0]); // 4 Writeln(a[1]); // 5 Writeln(a[2]); // 6 Writeln(b[0]); // 1 Writeln(b[1]); // 0 Writeln(b[2]); // 3