Calculating size of array before allocate memory