1
I am trying to assign the value of an array to two arrays, as follows:
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
contract ArrayExamples {
int[][] public matriz;
// Os dados são recebidos da seguinte forma: [0,0]
function receive_data(int[] data) public {
matriz.push(data);
}
function teste() public returns (int[] v) {
int[] x;
int[] y;
uint t = matriz.length;
for(uint i = 0; i < t; i++) {
x[i] = matriz[i][0];
y[i] = matriz[i][1];
}
return x;
}
}
The matrix is dynamic, but in the example above it takes as default an array with two elements. [0,0]
When I assign the values of x and y is not, only the values of y are assigned correctly. x is responsible for taking only the first value of the dynamic array and y takes the last value.
When will I check the value of x, it is said that it took the last value of the dynamic array, and it should take the first value of the array.
If I enter the following array: [4,5] - both x, how much y take 5, and x should take 4.