I wanted to know if I want an dynamic array so which method is more suitable and why is it more suitable
method 1:
int *p,x;
p= new int;
cin>>x;//input the limit of array
for(int i=0; i<x; ++i)
cin>>p[i];
method 2:
int *p,x;
cin>>x;//input the limit of array
p= new int[x];
for(int i=0; i<x; ++i)
cin>>p[i];
and when we follow this method where does the value of input elemet store (my guess is buffer)
int *p,x;
cin>>x;//input the limit of array
for(int i=0; i<x; ++i)
cin>>p[i];