Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Array Index-Problem (https://www.delphipraxis.net/82343-array-index-problem.html)

Neutral General 11. Dez 2006 16:07


Array Index-Problem
 
Hi,

Also entweder steh ich grad sowas von mega aufm Schlauch oder das hier ist komisch -.-

Delphi-Quellcode:
for y:= 0 to High(LGS.Bla) do begin
 LGS.Ext[y] := StrToInt(Stringgrid2.Cells[0,y]); // unwichtig
 for x:= 0 to High(LGS.Bla[y]) do begin
   LGS.Bla[y][x] := StrToInt(Stringgrid1.Cells[y,x]);
Wenn jetzt im Stringgrid steht

0 1
2 3

dann soll

Bla[0][0] = 0
Bla[0][1] = 1
Bla[1][0] = 2
Bla[1][1] = 3

sein.. Das müsste doch auch eig nach dem Code so werden oder ? :gruebel: :wall: -.-
Aber es ist so:

Bla[0][0] = 0
Bla[0][1] = 2
Bla[1][0] = 1
Bla[1][1] = 3

....

Gruß
Neutral General

3_of_8 11. Dez 2006 16:14

Re: Array Index-Problem
 
Arrays sind aufgebaut wie eine Matrix, das heißt der erste Index ist die Zeile, der zweite die Spalte.

Khabarakh 11. Dez 2006 16:19

Re: Array Index-Problem
 
Und bei Cells ist es genau umgekehrt...

Neutral General 11. Dez 2006 16:21

Re: Array Index-Problem
 
... k danke... Son Schwachsinn -.-

TeronG 11. Dez 2006 16:24

Re: Array Index-Problem
 
Zitat:

Zitat von 3_of_8
Arrays sind aufgebaut wie eine Matrix, das heißt der erste Index ist die Zeile, der zweite die Spalte.

Kann man das nicht halten/nennen wie man will?
Bzw. was ist dann der 3te, 4te oder gar 5te index? :mrgreen:

3_of_8 11. Dez 2006 17:01

Re: Array Index-Problem
 
Ja, aber so ist die Konvention, was die Darstellung betrifft.


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:21 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz