| Autor |
Beitrag |
rizor
      
Beiträge: 209
WIN XP
Delphi 2005 PE, Visual C++
|
Verfasst: Di 17.10.06 15:17
Hallo,
wie kann ich ein array zurücksetzen?
also ich habe 10 gruppen meines arrays und möchte es komplett zurücksetzen, dass ich
wieder bei 0 anfange zu zählen.
|
|
Martok
      
Beiträge: 3661
Erhaltene Danke: 604
Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
|
Verfasst: Di 17.10.06 15:22
Verstehe deine Frage nicht so wirklich, aber ich werf mal FillChar und SetLength(..,0) in den Raum....
Was für Gruppen des Arrays? Und wo zählt da wer?
_________________ "The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
|
|
alias5000
      
Beiträge: 2145
WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
|
Verfasst: Di 17.10.06 15:42
Ist das ein dynamisches Array? Ein statisches?
_________________ Programmers never die, they just GOSUB without RETURN
|
|
rizor 
      
Beiträge: 209
WIN XP
Delphi 2005 PE, Visual C++
|
Verfasst: Di 17.10.06 16:15
Es ist ein dynamischer array
|
|
alias5000
      
Beiträge: 2145
WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
|
Verfasst: Di 17.10.06 16:54
Delphi-Quelltext 1: 2: 3: 4: 5:
| var i: integer; begin i := length(MyArray); SetLength(MyArray, 0); SetLength(MyArray, i); |
_________________ Programmers never die, they just GOSUB without RETURN
|
|
rizor 
      
Beiträge: 209
WIN XP
Delphi 2005 PE, Visual C++
|
Verfasst: Do 19.10.06 16:32
Mein Problem ist nur, dass er sagt inkompatible Typen.
Mein Array ist ein String-Array
|
|
Vera
      
Beiträge: 82
WinXP Home
Delphi 2005 Personal
|
Verfasst: Do 19.10.06 16:41
rizor hat folgendes geschrieben: | | Mein Array ist ein String-Array |
Zeig mal bitte den Sourcecode der diesen Fehler erzeugt und die deklaration der Variable. 
|
|
rizor 
      
Beiträge: 209
WIN XP
Delphi 2005 PE, Visual C++
|
Verfasst: Do 19.10.06 16:45
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27:
| l:= length(efunktion.text); am:=0; for i:=0 to l do begin if (String(efunktion.Text[i])<>'+')and(String(efunktion.Text[i])<>'-')then begin if a[am]=#0 then begin a[am]:=String(efunktion.text[i]); end else a[am]:=a[am]+String(efunktion.text[i]); end else begin if (i<>0)then begin am:=am+1; if length(a)=(am-1) then setlength(a, am); a[am]:=String(efunktion.text[i]); end else if String(efunktion.text[i])<>'+' then a[am]:=String(efunktion.text[i]); end; end; |
am ist ein integer
Danke.
|
|
Vera
      
Beiträge: 82
WinXP Home
Delphi 2005 Personal
|
Verfasst: Do 19.10.06 16:47
Und in welcher Zeile kommt es zu einem Fehler?
|
|
rizor 
      
Beiträge: 209
WIN XP
Delphi 2005 PE, Visual C++
|
Verfasst: Do 19.10.06 16:59
|
|