Autor Beitrag
rizor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
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)
BeitragVerfasst: Di 17.10.06 15:42 
Ist das ein dynamisches Array? Ein statisches?

_________________
Programmers never die, they just GOSUB without RETURN
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Di 17.10.06 16:15 
Es ist ein dynamischer array
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
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)
BeitragVerfasst: Di 17.10.06 16:54 
ausblenden 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 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 19.10.06 16:32 
Mein Problem ist nur, dass er sagt inkompatible Typen.
Mein Array ist ein String-Array
Vera
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 82

WinXP Home
Delphi 2005 Personal
BeitragVerfasst: Do 19.10.06 16:41 
user profile iconrizor hat folgendes geschrieben:
Mein Array ist ein String-Array

Zeig mal bitte den Sourcecode der diesen Fehler erzeugt und die deklaration der Variable. ;-)
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 19.10.06 16:45 
ausblenden 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 //Kontrolle ob Zahl oder Operator
    begin
      if a[am]=#0 then     //kontrolle ob array leer ist
      begin
        a[am]:=String(efunktion.text[i]);     //wenn ja, dann beschrieben
      end
      else
        a[am]:=a[am]+String(efunktion.text[i]);  //ansonsten anfügen an einträge
    end
    else  //Wenn i ein '+' or '-' enthält dann
    begin
      if (i<>0)then  //Wenn mitten in der Funktion dann nächstes Teil in nächstem array speichern
      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  //wenn am anfang dann gucken ob i '-' enthält
          a[am]:=String(efunktion.text[i]);    //erstes array beschreiben
    end;
  end;

am ist ein integer

Danke.
Vera
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 82

WinXP Home
Delphi 2005 Personal
BeitragVerfasst: Do 19.10.06 16:47 
Und in welcher Zeile kommt es zu einem Fehler?
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 19.10.06 16:59 
In Zeile 20