Autor Beitrag
Jacdelad
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109

Win XP Pro
Borland Developer Studio 2006 Architect
BeitragVerfasst: Sa 20.05.06 13:15 
Hallo,

also wie man dynamische Arrays mittels "array of" und "Setlength" erzeugt weiß ich schon, aber was kann ich machen, wenn ich eine bestimmte Anzahl von diesen Arrays brauche, vorher aber noch nicht weiß wie viele. Beispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure irgendwas();
var koord:array of array of tpoint;
begin
SetLength(koord,100,100);
end;


Soweit ganz normal, nun brauche ich koord aber beispielsweise 7 mal (oder achtmal...), ohne dass ich vorher weiß wie oft (wird beispielsweise als Parameter übergeben). Wie kann man das realisieren?

Jac

_________________
Es gibt 10 Arten von Menschen: Die einen, die Binärcode verstehen und die, die es nicht tun.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 20.05.06 13:30 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure irgendwas();
var koord:array of array of array of tpoint;
begin
SetLength(koord,X,100,100);
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 20.05.06 13:33 
Ich hab nich ganz kapiert was du meinst, aber ...

ausblenden Delphi-Quelltext
1:
2:
SetLength(koord,100);
for i:= 0 to high(koord) do setLength(koord[i],100);

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Jacdelad Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109

Win XP Pro
Borland Developer Studio 2006 Architect
BeitragVerfasst: Sa 20.05.06 13:37 
Naja, auf die Idee bin ich auch schon gekommen, aber x soll vom Typ Integer sein. Also ich will das Array koord[a,b] x-mal haben.

_________________
Es gibt 10 Arten von Menschen: Die einen, die Binärcode verstehen und die, die es nicht tun.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 20.05.06 13:39 
ausblenden Delphi-Quelltext
1:
SetLength(koord[a,b],x);					

So, jetzt aber.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Jacdelad Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109

Win XP Pro
Borland Developer Studio 2006 Architect
BeitragVerfasst: Sa 20.05.06 13:41 
@JayEff: Aha, kling plausibel. Aber greife ich dann auf die einzelnen Elemente zu?

_________________
Es gibt 10 Arten von Menschen: Die einen, die Binärcode verstehen und die, die es nicht tun.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 20.05.06 13:42 
ausblenden Delphi-Quelltext
1:
for i:=0 to high(koord[a,b]) do koord[a,b,i].x:=1;					

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Jacdelad Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109

Win XP Pro
Borland Developer Studio 2006 Architect
BeitragVerfasst: Sa 20.05.06 13:46 
Ah, hm, ich probiers mal aus. (Bin spätestens heute abend verzweifelt!)

_________________
Es gibt 10 Arten von Menschen: Die einen, die Binärcode verstehen und die, die es nicht tun.