Autor Beitrag
phoric
Hält's aus hier
Beiträge: 10



BeitragVerfasst: Fr 24.02.06 14:39 
Ich möchte eine Array als Parameter an eine Funktion übergeben, aber bekomme immer diese Fehlermeldung:

Zitat:
Inkompatible Typen


Mein Funktionskopf sieht so aus:
ausblenden Delphi-Quelltext
1:
2:
type Tarray = array of array of integer;
function fehler (ar: tarray;a,b,x:integer) : boolean;


Hier wird die Funktion aktiviert:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
var a,b,x,y,z:integer;
begin
...
until fehler(ar,a,b,x)=false or (ar[a,b]>9); //<---Hier triit der Fehler auf!
...
end;


Deklariert habe ich die Array so:
ausblenden Delphi-Quelltext
1:
2:
3:
var
  Form1: TForm1;
  ar: Array of array of integer;


Danke für eure Hilfe!r

Moderiert von user profile iconTino: Quote- durch Delphi-Tags ersetzt.
LLCoolDave
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 212

Win XP
Delphi 2005
BeitragVerfasst: Fr 24.02.06 14:48 
Warum deklarierst du ar nicht auch als TArray?
phoric Threadstarter
Hält's aus hier
Beiträge: 10



BeitragVerfasst: Fr 24.02.06 14:57 
Welche Änderungen soll ich genau vornehmen?
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Fr 24.02.06 15:00 
ausblenden Delphi-Quelltext
1:
2:
3:
var 
  Form1: TForm1; 
  ar: TArray;

_________________
Ein Nutzer der Ecke ;-)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 24.02.06 16:44 
Änder am besten folgende Zeile auch gleich noch mit, um Klammerungsfehler zu vermeiden:

ausblenden Delphi-Quelltext
 
5:
{ ... }
until (not fehler(ar,a,b,x)) or (ar[a,b]>9);

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
phoric Threadstarter
Hält's aus hier
Beiträge: 10



BeitragVerfasst: So 26.02.06 17:59 
Danke, für die schnelle Hilfe!