how to modify 2d array in function c++

#include <iostream>

const int ROWS = 3;
const int COLS = 3;

void modifyArray(int arr[ROWS][COLS]) {
    // Modify the elements of the 2D array
    for (int i = 0; i < ROWS; ++i) {
        for (int j = 0; j < COLS; ++j) {
            // Example modification: Increment each element by 1
            arr[i][j] += 1;
        }
    }
}

int main() {
    // Initialize a 2D array
    int myArray[ROWS][COLS] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

    // Display the original array
    std::cout << "Original Array:" << std::endl;
    for (int i = 0; i < ROWS; ++i) {
        for (int j = 0; j < COLS; ++j) {
            std::cout << myArray[i][j] << " ";
        }
        std::cout << std::endl;
    }

    // Call the function to modify the array
    modifyArray(myArray);

    // Display the modified array
    std::cout << "\nModified Array:" << std::endl;
    for (int i = 0; i < ROWS; ++i) {
        for (int j = 0; j < COLS; ++j) {
            std::cout << myArray[i][j] << " ";
        }
        std::cout << std::endl;
    }

    return 0;
}