how to initialized a 2d vector

#include <iostream>
#include <vector>

int main() {
    // Step 1: Specify the number of rows and columns
    int rows = 3;
    int columns = 4;

    // Step 2: Initialize a 2D vector with the specified size
    std::vector<std::vector<int>> myVector(rows, std::vector<int>(columns));

    // Step 3: Access and modify elements in the 2D vector
    myVector[1][2] = 42;

    // Step 4: Display the elements of the 2D vector
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < columns; ++j) {
            std::cout << myVector[i][j] << " ";
        }
        std::cout << std::endl;
    }

    return 0;
}