# What does #undef mean?

**URL:** <https://discourse.julialang.org/t/what-does-undef-mean/82031>\
**Category:** General Usage\
**Tags:** question, dictionary\
**Created:** [June 1, 2022, 6:35am UTC](https://discourse.julialang.org/t/what-does-undef-mean/82031 "2022-06-01T06:35:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [June 1, 2022, 6:43am UTC](https://discourse.julialang.org/t/what-does-undef-mean/82031/2 "2022-06-01T06:43:00Z")

</div>

Lots to unpack here, let’s start with 1 & 2:

`#undef` simply stands for a reference that hasn’t been specified yet. See the following example:

```julia
julia> x = Vector{Int}(undef, 3)
3-element Vector{Int64}:
 139777823454816
 139777979780016
               0

julia> y = Vector{String}(undef, 3)
3-element Vector{String}:
 #undef
 #undef
 #undef

```

Initializing a vector with `undef` means that we don’t specify its content yet.

- In the case of an `Int` eltype, the vector knows the size (in bytes) of its elements and “reserves” it, but since we haven’t written anything it still contains whatever was there in memory before. Hence the seemingly random numbers, which may be different if i do it again.
- But in the case of a `String` eltype, the vector doesn’t know the size of its elements, so it just stores an `undef` for each one.

---

_[View the full topic](https://discourse.julialang.org/t/what-does-undef-mean/82031)._
