Why does an uninitialized fixed array get initialized to 0 or 1 using for loop

can anyone tell me why does the output of the following code give {0,1,0,1,0,1}, by that i mean to ask why does it get initialized to 0 and 1 alternatively?

module tb;
bit one[6];
int total;
initial begin
foreach(one[i])
one[i] = i;

  $display("%p",one);
end

endmodule

In reply to yr:


one is a 1 bit array. What do you expect? it stores lsb.
// 000 001 010 011 100 101 

what you want is below i guess?

module tb;
  bit [2:0] one[6];
int total;
initial begin
foreach(one[i])
one[i] = i;
 
$display("%p",one);
end
endmodule

In reply to rag123:

got that ! Thanks.