length of array only can be calculated in main().