Re: [Dev-C++] Question about pointers vs 2-D arrays
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: matheus r. <mfr...@gm...> - 2007-09-23 17:12:13
|
Hi
> Can anyone tell me what formula I
> can use to referenciate one 2-D array
> element dynamically allocated?
#include <iostream>
#define LIN 3
#define COL 2
using namespace std;
int main(){
double **a;
a = new double*[LIN];
for (unsigned int i=0;i<LIN;++i){
a[i] = new double[COL];
}
a[2][1] = 5.0;
cout << a[2][1] <<endl;
}
|