# What is the difference between scalar array and vector array?

First question

Whether we declare the array as scalar or vector, we can access each element bit by bit. For example, we can declare two arrays below.

reg scalar_array[0:9];
reg [0:9] vector_array;

always @*
begin
scalar_array[0] = 1'b1;
vector_array[0] = 1'b1;
end


I would like to know if the difference exists between two declarations.

Second question

Also, when I declare the two-dimensional array like below, I could access the entire row using the indexing operator[] for the variable declared using a below syntax.

reg[X:X] var_name [Y:Y];


However, I couldn't access the entire row when I declare the array using the below syntax.

reg var_name [X:X][Y:Y];


I would like to know how this concept can be synthesized on the hardware, and if they are both synthesizable, what is the difference between them.

reg [0:9] vector_array_2d [0:15];
reg scalar_array_2d[0:9][0:15];
always @*
begin
vector_array_2d[0] = 'd1;
scalar_array_2d[0] = 'd1; //raise the error!!
end