Hi @all
I was trying to learn dynamic allocation of arrays. I wrote easy program. Can someone tell me why I can't print out all integers in my array.
Thanks
Code:#include <iostream> using namespace std; int main() { const int sentinel=-9; int *arrPtr= new int[]; int in; int i=0; cout <<"Enter integers"<<endl; cin >>in; while (cin.good()&&(in!=sentinel)) { arrPtr[i]=in; i++; cin>>in; } for (int m=0; m<(sizeof (arrPtr)/sizeof (arrPtr[0])); m++) cout <<arrPtr[m]<<" "; cout <<endl; return 0; }Code:input: 1 2 3 output: 1 :confused: