Value Assignment Dynamic Array without new()


module top;
  integer da4[];
  initial begin
    da4='{1,2,3,4};
    $display("da4=%p",da4);
  end
endmodule

Result: da4='{1,2,3,4};

Doubt: Can we assign value in Dynamic array without using new();

In reply to Kj@2199:

Please use code tags making your code easier to read. I have added them for you.

From the LRM section 7.5 Dynamic arrays:

The size of a dynamic array is set by the new constructor or array assignment, described in 7.5.1 and 7.6 respectively.

So the answer to your question is yes, you can assign a value to a dynamic array without using new().

In reply to cgales:

Thank you for the clarification.