This is an array declaration:
int array[] = {1, 2, 3, 4, 5};
is the same as:
int array[5] = {1, 2, 3, 4, 5};
The number of elements is computed at compile time, so the runtime is not associated with this.
The advantage of the first declaration is that the programmer does not need to manually count the number of elements, so in this sense it is a more efficient declaration of the array.
source share