C++ How to insert and print array elements?

#include <iostream>

int main() {
    const int arraySize = 5;  // Define the size of the array
    int myArray[arraySize];   // Declare an array of integers

    // Insert elements into the array
    for (int i = 0; i < arraySize; ++i) {
        std::cout << "Enter element at index " << i << ": ";
        std::cin >> myArray[i];
    }

    // Print elements of the array
    std::cout << "Elements of the array: ";
    for (int i = 0; i < arraySize; ++i) {
        std::cout << myArray[i] << " ";
    }

    return 0;
}