Dynamic array of queue

Hi all,
i am not able to do the below:

“create a dynamic array of queue. let the array have 2 elements and add 2 more element each in the queue.and then print the structure.”

please help me solve this.
thanks in advance.
regards,
vinay

In reply to kumar-vin:

I think, following code will solve your purpose.


 int q[][$];
 initial begin
   q = new[2];
   foreach(q[i])
   begin
     repeat(2) q[i].push_back($urandom_range(0,255));
   end 
   foreach(q[i])
   begin
     for(int j =0; j<q[i].size(); j ++)
          $display("I %0d J %0d Q[%0d][%0d] : %0d", i, j, i, j, q[i][j]);
   end
 end

Note that, i am pushing random data between 0 to 255, you can do as per your requirement.

In reply to mitesh.patel:

thank you very much !!