How to allocate an array dynamically….if possible then please write the code while explaining your views which will help me in understanding the logic in a better way.