Re: Array pointers like C++
- From: Jamie <jamie_5_not_valid_after_5_Please@xxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 12:32:03 -0700
news.online.no wrote:
VarHi,
I am struggling with translating some code from C++ to Delphi.
Consider this C++ code:
class var: double someArray[2][4][6];
local method vars: int a, b, c, d, e; ... // vars initialized double *l = someArray[a][b]; double p = l[c] = (double) d/e; l[0] = p;
What is actualy happening here? is someArray changed in the local method? How can I do this in Delphi, or Object Pascal in general?
Bjorn
SomeArray:Array[0..1,0..3,0..5] of double; // or Array[0..1][0..3][0..5]of double
a,b,c,d,e:integer; l :PdoubleArray; P :Double; Begin // initiate your Variables. l := @SomeArray[A,B,0]; // use zero in un specified indexes. P := l[c]; l[o] := p;
P.S. in case for some reason you don't have that TdoubleArray in the sysUtils file just create the type your self.. type PDoubelArray = ^TDoubleArray; TDoubleArray = Array[0..32768] of Double;
.
- Follow-Ups:
- Re: Array pointers like C++
- From: Bjorn Antonsen
- Re: Array pointers like C++
- References:
- Array pointers like C++
- From: news.online.no
- Array pointers like C++
- Prev by Date: Re: Assigning Variables at runtime?
- Previous by thread: Array pointers like C++
- Next by thread: Re: Array pointers like C++
- Index(es):