C++ Syntax for Passing Arrays as Function Parameters

When passing a 1D array as a function parameter in C++, you can do so by declaring the array parameter as a pointer. The syntax is as follows:

void functionName(dataType* arrayName, int arraySize) {
  // Function code using the array
}

When passing a 2D array as a function parameter in C++, you can do so by indicating the size of the second dimension in the array parameter. The syntax is as follows:

void functionName(dataType arrayName[][columnSize], int rowSize) {
  // Function code using the 2D array
}