Doubt 1: Even though without creating a memory the array is taking the value, then what is the point of dynamic array?
Ref. to Doubt 1:
module ex;
int x [ ];
initial begin
//Here i am not creating the memory
$display(“size=%0d”,x.size());
x = '{1,2,3,4,5,6,7};
$display(“x=%p”,x);
$display(“size=%0d”,x.size());
end
endmodule
Doubt 2: While assigning the elements to the array, here I had created the size 3 and assign some 7 elements, and its working.
But, after assigning the value using foreach loop, and the if i try to assign to the out of bound value then it is displaying 0.
Ref. to Doubt 2:
module ex;
int x [ ];
initial begin
x=new[3] //Size =3
$display(“size=%0d”,x.size());
x = '{1,2,3,4,5,6,7}; // assigning more elements greater than the size
$display(“x=%p”,x);
$display(“size=%0d”,x.size());
end
endmodule

