i have done through this way(below) as a example to check is it working or not...still its going good..may be it is not good approach i am new in c/c++..
#include<iostream>
using namespace std;
int *ptr;
int i=0;
int x=0;
void main()
{
cout<<"Plesae enter the length of array";
cin>>i;
ptr=(int*) calloc (i,sizeof(int));