Page 1 of 1

Passing an array to a function

Posted: Wed Apr 28, 2004 9:05 am
by peter
I was wondering if I can pass an array to a function.
And the function must return an array.
For example I want to make a outproduct or dotproduct function

So

procedure outproduct(vecta(3),vectb(3))
code
return vect(c)
endprocedure

This doesn't work of course, but how can I do this easily?

Posted: Wed Apr 28, 2004 9:38 am
by blueznl
Structure whatever
b.b
EndStructure

Procedure aha(*a.whatever, *b.whatever)
*b\b = *a\b
EndProcedure

x.whatever
y.whatever

x\b = 5
aha(@x,@y)
Debug y\b

Re: Passing an array to a function

Posted: Wed Apr 28, 2004 9:39 am
by traumatic
peter wrote: procedure outproduct(vecta(3),vectb(3))
code
return vect(c)
endprocedure
I'd do it with structures...

Code: Select all

Structure VECT
  x.f 
  y.f 
  z.f 
EndStructure 

Procedure outproduct(*va.VECT, *vb.VECT, *out.VECT) 
  code
EndProcedure 
maybe you may also take a look at this:
viewtopic.php?t=9457

Re: Passing an array to a function

Posted: Wed Apr 28, 2004 9:39 am
by traumatic
ooops, too late... :(