Queues

How to insert one queue into another queue?

Use unpacked array concatenation:

int foo[$], bar[$], baz[$];

foo = { 1,2,3 };
bar = { 4,5,6 };
baz = { foo, bar };

Regards,
Mark

In reply to Mark Curry:

I have tried with this method :

Int q1[],q2[];
Foreach (q1[i])
Begin
q2.insert(i,q1[i]);
End

Is this one is correct?

Pradeep ,

Use code blocks while sharing your code in this forum .

int q1[$],q2[$];
foreach (q1[i])
begin
q2.insert(i,q1[i]);
end

Your code should work perfectly fine provided you take care of your syntax errors .

Another suggestion , you can directly pass the q1 into q2 instead of using the foreach loop.

int q1[$],q2[$];
begin
q2=q1;
end

And the method for array concatenation is already shared by Mark.

~Pranoy

In reply to PR359708:

Thanks for the suggestion