When using Vector{T}(undef,n) constructor, what are the values set to?

The values you get are whatever is in memory. They are actually not set to anything at all, so the values are completely undefined.

If you want your data initialized to 0, then use zeros. For other values, use fill!.

See also Faster zeros with calloc

1 Like