Passing array as an argument (packed vs unpacked, dynamic vs fixed)

In reply to gabi0307:

You can always copy equivalently typed unpacked arrays (fixed-sized, dynamic, or queues) from one kind to another as a whole array (associative arrays can only be copied to the same kind as a whole). The target array automatically gets correctly sized to size of the source array. If the target array is fixed-sized, you get an run-time error if the source array is not the exact same size as the target.

Passing an argument by reference(ref) requires exact matching types making it much more restrictive. The main use of ref arguments is when you have a time consuming task and need the argument values updated during the life of the task. Input arguments copy their value on entry to the task, and output arguments copy their value on exit of the task. You would not see any other intermediate value changes. Another use of ref arguments is if you have very large arrays and only plan to access a few of the elements from inside the task/function. This prevents the overhead of trying to copy the entire array.

You will have to post more code for help on your 3rd question.