Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to fix Tyes of actual and formal var parameters must be identical

Status
Not open for further replies.

puk5629

Programmer
Jul 11, 2010
13
GB
Hi Everyone,

I writen a procedure which content two-dimensional dynamic array and I tried to call the procedure in another procedure. But it shows, types of actual and formal var parameters must be identical.

Here is the sample coding,

Type
MatrixArray:array of array of double;

procedure TForm1.Generation(var Source:MatrixArray; var Nsource:integer);
begin
Nsource:=1000;
SetLength(Source, Nsource, 4);
for i:=0 to Nsource-1 do
begin
X:=random;
Y:=random;
Z:=0;
L:=1;
begin
Source[i,0]:=X;
Source[i,1]:=Y;
Source[i,2]:=Z;
Source[i,3]:=L;
end;
end;
end;

procedure TForm1.CalculateClick(Sender: TObject);
var
source:array of array of double;
Nsource:integer;
begin
Generation(source,Nsource); -->Error occurs here
for i:=0 to Nsource-1 do
begin
XL:=Source[i,0]+1;
YL:=Source[i,1]+1;
ZL:=Source[i,2]+1;
LL:=Source[i,3]+1;
Series1.AddXY(XL,YL);
end;
end;
end.

Thank you all for your help.

Vincent
 
In a strongly typed language, multiple identical definitions of non-core variable types are considered separate declarations. Define source in CalculateClick to be MatrixArray.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Thank you very much for your help.

Vincent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top