When you declare a two-dimensional array dynamic assignment and enter the number of rows and columns, you want all the elements in the array to be initialized to 0.0, but I'm not sure what's wrong.
void creatematrix(int row, int col)
{
cin >> row >> col;
double** data = new double* [row];
for (int i = 0; i < row; i++)
{
data[i] = new double[col];
}
for (int i = 0; i < row; i++)
for (int j = 0; j < col; j++)
{
data[i][j] = { 0.0 };
}
If you enter cout and delete below, it will not be executed. I would really appreciate it if you could tell me where it went wrong :)
array allocation initialization c c++
data[i][j] = { 0.0 };
==> data[i][j] = 0.0;
© 2024 OneMinuteCode. All rights reserved.