C++ Code Example: for-loop through an array to output the content

#include <iostream>
using namespace std;

int main() {
    int myArray[] = {4, 8, 1, 56, 73, 36, 99, 21};
    int myArrayLength = sizeof(myArray) / sizeof(*myArray);

    for (int i = 0; i < myArrayLength ; i++) {
        cout << myArray[i] << endl;
    }
}
Output
4
8
1
56
73
36
99
21