Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Confusion over passing by reference vs passing by value
#11
As far as I know, BASIC doesn't allow one to set a whole array to some value all at once, which is what you're trying to do here:

satz3() = "SagNiemalsNie!"

You need an index of some sort to assign the value to, such as the below here:

Code: (Select All)
Dim satz3(10) As String


Print
satz3(0) = "SagNiemalsNie!"
Satztest3 satz3() '!! Damit hat der Compiler Probleme
Print "Wert des Feldes von satz3 nach der Subroutine: ", satz3(0)

End



Sub Satztest3 (feld() As String)
    feld(0) = feld(0) + "DonaldDuck"
End Sub

Note also that you can not pass arrays via parenthesis.

Satztest3 (satz3()) -- this is bugged and produces a c++ compile failure.

Satztest3 satz3() -- change it to this and it works perfectly fine.
Reply


Messages In This Thread
RE: Confusion over passing by reference vs passing by value - by SMcNeill - 06-19-2022, 06:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Array out of passing arrays... Pete 2 417 09-22-2025, 08:53 PM
Last Post: ahenry3068
  Call by reference / value Kernelpanic 3 926 11-28-2023, 03:41 AM
Last Post: TerryRitchie
  Variable as a reference or value to a function Kernelpanic 22 4,341 08-08-2022, 07:41 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)