KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Use a pointer to pass an array as parameter
PRODUCT: 4D | VERSION: 13.1 | PLATFORM: Mac & Win
Published On: September 12, 2012

4D does not allow Arrays to be used as parameters to methods. It does allow pointers; thus a pointer to an array is an acceptable substitute.

For example this method, named increment, takes a pointer to an array as a parameter.

C_POINTER($1;$arr)
$arr:=$1

For ($i;1;Size of array($arr->))
   $arr->{$i}:=$arr->{$i}+1
End for


increment(->$test)


To call this method simply pass a pointer to an array.