Autor Beitrag
[r2d2]
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109

WinXP
D5 Enterprise
BeitragVerfasst: Mi 27.08.03 22:33 
Ist es möglich, allen Elementen eines Arrays den Wert nil zuzuordnen, ohne den Wert jedes Segments einzeln neu zu setzten?
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mi 27.08.03 22:47 
keine ahnung ob das geht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var
 olength: integer;
begin
 olength := length(array);
 setlength(array0);
 setlength(array, olength);
end;


[EDIT]
wenn überhaupt nur bei dynamischen arrays.

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Do 28.08.03 00:27 
Bei statischen Arrays ist das recht einfach:

ausblenden Delphi-Quelltext
1:
ZeroMemory(@DasArray, Sizeof(DasArray));					

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Do 28.08.03 09:55 
Die Methode von Chewie funzt auch bei dyn. Arrays:
ausblenden Delphi-Quelltext
1:
2:
ZeroMemory(@szArray[0], // die Adresse des ersten Elements übergeben
Length(szArray) * SizeOf(szArray[0])); // die Größe des Arrays ist die Länge mal die Größe eines einzelnen Elements

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Taurin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34

Win XP
D6 Personal
BeitragVerfasst: Fr 29.08.03 16:27 
Du solltest dabei aber aufpassen, dass dir nicht irgendwie Speicher
verloren geht, falls die Pointer in deinem Array vorher auf was gezeigt
haben.