Function call; fields of the object have junk value

In reply to Verif Engg:

Because you are creating a new pkt object with “pkt = new();” in the function A(), before $display.