Pass array to a function

In reply to verif_learner:

Usually, the packet is a class object with an arrays as a member. You just pass the object’s handle as an input to the function.

If you make sure you always use a dynamic array, you can pass an array by reference.

module x;
  function func1 (ref int a []);
    $display ("%p", a);
  endfunction
 
  initial begin
    int a [];
    a = {1,2,3,4,5};
    func1(a);
  end
endmodule