i have following code for allocation two dimensional array
#include <iostream>
using namespace std;
int **malloc2d(int r,int c){
int **t=new int*[r];
for (int i=0;i<r;i++)
t[i]=new int[c];
for (int i=0;i<r;i++){
for (int j=0;j<c;j++){
t[i][j]=i+j;
}
}
return t;
}
int main(){
int m=10;
int n=10;
int **a=malloc2d(m,n);
for (int i=0;i<m;i++){
for (int j=0;j<n;j++){
cout<<a[i][j]<< " ";
cout<< " \n";
}
cout<< " \n";
}
return 0;
}
it works but my question is: how good is this code according to performance efficienty or according to code speed? thanks