You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
program calculate{
function foo() : Integer[] {
a, b : Integer[];
a := new Integer[3];
for i = 0 to #a -1 {
a[i] := 1;
}
return a;
}
procedure print_two_arrays(firstArray, secondArray : Integer[]) {
println(firstArray);
println(secondArray);
}
procedure bar() {
s, t : Integer[];
s := {1,2,3};
t := foo();
print_two_arrays(s, foo()); // this prints : "null \n {1,1,1}"
print_two_arrays(s, t); // this prints : "{1,2,3} \n {1,1,1}"
}
bar();
}
Expected would be "{1,2,3} \n {1,1,1}" in both cases.
This does NOT occur, when "foo()" is written as follows:
function foo() : Integer[] {
a : Integer[];
b : Integer[];
a := new Integer[3];
for i = 0 to #a -1 {
a[i] := 1;
}
return a;
}
The text was updated successfully, but these errors were encountered:
Expected would be "{1,2,3} \n {1,1,1}" in both cases.
This does NOT occur, when "foo()" is written as follows:
The text was updated successfully, but these errors were encountered: