I am trying to make a 2D array in C++ and fill it with user input, but once I start typing in values the program just stops giving me "Process finished with exit code -1073741819 (0xC0000005)"
double ** array = new double*[col];
for( i=0;i< col; i++){
array[i] = new double [row];
}
for(i1=0;i1<row;i1++){
for(j=0;j<col;j++){
cin>> n;
array[i1][j] = n;
}
}
for(i1=0;i1<row;i1++){
cout<<" "<<endl;
for(j=0;j<col;j++){
cout<< array[i1][j];
cout<<" ";
}
}
Any ideas how to solve this?
new[], usestd::vectorinstead.std::vector(without the necessity of all thesenews).