Trouble with Arrays inside Arrays

Hey guys. I'm new to programming with Arduino and I wanted to experiment by creating an LED matrix on Tinkercad circuits. It looks like this (Imgur: The magic of the Internet). I basically want to have preset patterns that the arduino can write to the matrix. (for now, there is just one pattern called "CubePattern"). The ChangePattern function basically goes through each row and column of a pattern(For now just CubePattern) and decide if it should be on or not. However, I keep getting an error at at the line:

"if (Pattern[ThisRow][ThisColumn]==1){"

This line is basically trying to index an array inside an array and check if it's 1. (I hope I worded that correctly)

The error says:

In function 'int ChangePattern(int*)':
60:38: error: invalid types 'int[int]' for array subscript

I've tried and researched a bunch of things and nothing has worked. It is likely something obvious but I'm new to this so I'd appreciate the help. Thanks! Also, if there's anything else I can improve about the code let me know!

int ledpins[8]{1,2,3,4,5,6,7,8};
int CollumnPins[4]{1,2,3,4}; //Negative
int RowPins[4]{5,6,7,8};//Positive


// the setup routine runs once when you press reset:
void setup() {
  for (int thisPin = 1; thisPin < 4; thisPin++) { //Turn all Column pins on high 
    pinMode(ColumnPins[thisPin], OUTPUT);
    digitalWrite(ColumnPins[thisPin],HIGH);
  }
  for (int thisPin = 5; thisPin < 8; thisPin++) { //Turn all Row pins on low
    pinMode(RowPins[thisPin], OUTPUT);
    digitalWrite(RowPins[thisPin],LOW);
  }
 
}

void loop() {
  
  int CubePattern[4][4] = { //A pattern that I want to have on the LED matrix, 1's being on, 0's being off
    {0, 0, 0, 0}, 
    {0, 1, 1, 0},  
    {0, 1, 1, 0},
    {0, 0, 0, 0}
  
  };

  ChangePattern(CubePattern[4]);
}


int ChangePattern(int Pattern[4]){ //write pattern on Matrix
  for (int ThisRow = 1; ThisRow < 4; ThisRow++) { //Negative.  
    for (int ThisColumn = 4; ThisColumn < 8; ThisColumn++) { 
      if (Pattern[ThisRow][ThisColumn]==1){   //LINE THAT GIVES THE ERROR
        digitalWrite(ThisRow, HIGH);
        digitalWrite(ThisColumn, LOW);
      }
    }
  }
}
int ChangePattern(int Pattern[4]){ //write pattern on Matrix

You first say that Pattern is a one-dimensional array, and then you try to index it as if it were a two-dimensional array, that's impossible of course.
Pattern is an array of ints, so Pattern[ThisRow] returns a single int. You can't use the array subscript operator ([ ]) on a single int, so the compiler complains.

Pieter

You have other problems as well (in setup()).

You have two arrays (and not one array in an array, better known as a two-dimensional array).

  for (int thisPin = 1; thisPin < 4; thisPin++)

Unless you specifically want to skip the first element of the array (number 0).

And looking at the next for loop, you don't understand how to use arrays

for (int thisPin = 5; thisPin < 8; thisPin++)

You only have 4 elements in the RowPins array. You access them by index (thisPin in your case) and not by the numbers that you placed in the array. The latter would never allow you to so something like

int something[] = {1,2,2,1};

A corrected setup

  for (int thisPin = 0; thisPin < 4; thisPin++) { //Turn all Column pins on high
    pinMode(ColumnPins[thisPin], OUTPUT);
    digitalWrite(ColumnPins[thisPin],HIGH);
  }
  for (int thisPin = 0; thisPin < 4; thisPin++) { //Turn all Row pins on low
    pinMode(RowPins[thisPin], OUTPUT);
    digitalWrite(RowPins[thisPin],LOW);
  }

PieterP:

int ChangePattern(int Pattern[4]){ //write pattern on Matrix

You first say that Pattern is a one-dimensional array, and then you try to index it as if it were a two-dimensional array, that's impossible of course.
Pattern is an array of ints, so Pattern[ThisRow] returns a single int. You can't use the array subscript operator ([ ]) on a single int, so the compiler complains.

Pieter

Thanks! I think I understand the problem to a degree now, but I still have no idea how to fix it. I've tried a couple things based on your explanation but I think I'm just not getting something. How would you suggest fixing it?

EDIT: Nevermind, I appeared to have fixed it!