Question: To create a struct I can do one of the following:

```
// Method 1
Item *item = malloc(sizeof(Item));
Item _item = {.name="job"};
item = &_item;

// Method 2
Item *item = malloc(sizeof(Item));
item->name="job";

```

Is there a simpler method to do this? Perhaps something along the lines of:

```
malloc(sizeof(Item)) & (Item) {.name="job"}

```

Here are the two methods: <https://godbolt.org/z/MfYGW3>

Answer: 
I prefer using `Parameters.jl` because it provides also a nicer way the `struct`s are displayed which is much nicer for debugging:

```
julia> using Parameters

julia> @with_kw struct A          
       a::Int=5                   
       b::String="hello"          
       c::Float64                 
       end;                                 

julia> A(c=3.5)                   
A                                 
  a: Int64 5                      
  b: String "hello"               
  c: Float64 3.5                  

```
This is exactly what `Base.@kwdef` does:

```
julia> Base.@kwdef mutable struct Scale
           # Set default values that will be changed by fit!()
           domain_min::Float64 = 0.0
           domain_max::Float64 = 1.0
           range_min::Float64  = 0.0 
           range_max::Float64  = 1.0
       end
Scale

# All parameters to their default values
julia> Scale()
Scale(0.0, 1.0, 0.0, 1.0)

# Specify some parameter(s) using keyword argument(s)
julia> Scale(range_min = 0.5)
Scale(0.0, 1.0, 0.5, 1.0)

```