Array question

New to FreeBASIC? Post your questions here.
Post Reply
Löwenherz
Posts: 192
Joined: Aug 27, 2008 6:26
Location: Bad Sooden-Allendorf, Germany

Array question

Post by Löwenherz »

Hello.. I am Not very fit with Arrays and freebasic

How I can fix my Code example with a SUB Array() ?

Code: Select all

' test code for array

Dim As Integer A(),B(),C(),X() 

ReDim A(1 To 4),B(1 To 4),C(1 To 4), X(1 To 4)
redim preserve A(1 to 10), B(1 To 10), C(1 To 8), X(1 To 10)

print lbound(a), ubound(a)

print lbound(b), UBound(b)

print lbound(c), UBound(c)

print lbound(x), ubound(x)

Sub GaussianElimination( A() As Single, B() As Single, X() As Single)
' test code
For i as integer = lbound(A) to ubound(A)
			A(i) = i
		Next
For i as Integer = lbound(B) to ubound(B)
			B(i) = i
		Next
For i as Integer = lbound(X) to ubound(X)
			X(i) = i
		Next

End Sub

' error 58, type mismatch at parameter 1 (A)
'Print GaussianElimination(A(), B(), X() )
sleep
fxm
Moderator
Posts: 12386
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Array question

Post by fxm »

You must pass to GaussianElimination Single arrays, not Integers arrays
In addition, GaussianElimination is not a function but a subroutine.
Post Reply