return array

New to FreeBASIC? Post your questions here.
Posts: 4
Joined: Jun 28, 2018 20:44

return array

Postby als_santos » Jul 11, 2018 18:27

Como retornar uma array de uma função, ex:

How to retrieve an array from a function, ex:

Code: Select all

function test(x as integer, y as integer) as string
  dim return_(0 to 1) as string
  return return_
end function

dim a(0 to 1) as string
a = test(1, 2)
Posts: 639
Joined: May 05, 2015 5:35
Location: Germany

Re: return array

Postby grindstone » Jul 11, 2018 21:24

Code: Select all

Sub test(x As Integer, y As Integer, return_() As String)
End Sub

Dim return_(0 To 1) As String

test(1, 2, return_())
Print return_(0)
Print return_(1)


The array has to be passed in the parameter list (arrays are always passed ByRef)

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 2 guests