Dynamic arrays refer to arrays that do not have a pre-determined size at the time of declaration; however, their size is determined at runtime. Take a look at the following code:
int[] age ; // array of int with no fixed storage space allocated. Storage is allocated during assignmentbyte[] flags ; // array of byte with no fixed storage space allocated
Dynamic arrays can be initialized inline or using the new operator. The initialization can happen at the time of declaration as follows:
int[] age = [int(10), 20,30,40,50] ;int[] age = new int[](5) ;
The initialization can also happen within a function later in the following two different steps:
int[] age ;age = new int[](5) ;