I set the size of the array after compiling the program without using dynamic allocation. I can't understend why this code is working. I can guess that compiler create the array with length of array = 0, because variable length is equal to zero.
#include <iostream>
using namespace std;
int main()
{
    cout << "Enter length of the array: ";
    int length;
    cout << length << endl;
    cin >> length;
    int array[length] = {};
    for(int i = 0; i < length; i++)
    {
        array[i] = i;
        cout << array[i] << endl;
    }
    return 0;
}
