Passing a 2D Array (int) as a Parameter to a function
in
Programming Questions
•
6 months ago
Hi There,
I'm trying to use a common function to perform a number of operations on a similar sized 2d arrays. This function used to work on the Arduino platform, but doesnt seem to work on processing. (1.5.1). the error given is : expecting TRIPLE_DOT found "......"
I've attached a basic code with the function, although in practice the operations on the array are more than what i've written below, as it does not affect the problem what i have.
I've attached a basic code with the function, although in practice the operations on the array are more than what i've written below, as it does not affect the problem what i have.
Many Thanks in advance,
- int tankLength = 17; //row
- int tankWidth = 9;//collumns
- int[][] tank = new int[tankLength][tankWidth]; // original data with
- int[][] cctank = new int[tankLength][tankWidth]; // tank with binary image
- int[][] pxtank = new int[tankLength][tankWidth]; // tank with sorted blobs
- void setup() {
- noloop();
- }
- void draw() {
- tank[1][2]=9;
- tank[3][5]=1;
- tank[7][5]=10;
- PrintArray(tank[17][9]);
- cctank[1][2]=1;
- cctank[3][5]=1;
- cctank[7][5]=1;
- PrintArray(cctank[17][9]);
- }
- void PrintArray(int TheArray[17][9], int k, int l) {
- for (int i=0; i<k; i++) {
- for (int j=0;j<l; j++) {
- Serial.print(TheArray[i][j]);
- }
- Serial.println(" ");
- }
- Serial.println(" ");
- }
1