Hello guys,
I can't figure how can I transmit an array, by reference, to a sub
I've wrote this code:
>>>>>>>>>>>>>
dim a(4) as INTEGER
cls
a(0)=1
a(1)=2
a(2)=3
a(3)=4
call s_makeSum(a)
end
sub s_makeSum(b)
dim i as INTEGER, sum as INTEGER
sum=0
for i=0 to 3
? b(i)
sum=sum+b(i)
next i
? ">"+STR$(sum)+"<"
end sub
>>>>>>>>>>>>
why b(0)=b(1)=b(2)=b(3)=0 ???
what is wrong whit my code?
thanks alot,
alex
I can't figure how can I transmit an array, by reference, to a sub
I've wrote this code:
>>>>>>>>>>>>>
dim a(4) as INTEGER
cls
a(0)=1
a(1)=2
a(2)=3
a(3)=4
call s_makeSum(a)
end
sub s_makeSum(b)
dim i as INTEGER, sum as INTEGER
sum=0
for i=0 to 3
? b(i)
sum=sum+b(i)
next i
? ">"+STR$(sum)+"<"
end sub
>>>>>>>>>>>>
why b(0)=b(1)=b(2)=b(3)=0 ???
what is wrong whit my code?
thanks alot,
alex
Comment