Dimmi se ti va bene:
codice:
#include <iostream>
#include <new>
using namespace std;
void creo_matrice(double** matrice, int n, int m)
{
for(int j = 0; j < n; j++) {
for(int i = 0; i < m; i++) {
matrice[j][i] = 1.5;
}
}
for(int x = 0; x < n; x++) {
for(int y=0; y < m; y++) {
cout << matrice[x][y] << endl;
}
}
}
int main()
{
int n;
int m;
cout << "Inserire dimensione del primo array: ";
cin >> n;
cout << "Inserire dimensione del secondo array: ";
cin >> m;
double** matrice = new double*[n];
for(int i=0; i<n; i++) {
matrice[i] = new double[m];
}
creo_matrice(matrice, n, m);
return 0;
}
quello è il sistema per allocare un array bidimensionale.