Ladder
### Structs
Structs organize and group variables in a container so that they're easily accessible by a single pointer.
As in other languages, creating objects is extremely helpful in keeping your abstractions clean!
Let's analyze the code
- We can declare a struct type by using the `struct name {fields}` syntax.
- To access fields of a struct value, we can use the `.` syntax.
- To access fields of a struct pointer, we have two choices
- We can dereference the pointer to get a struct value and then use the `.` notation
- Or we can use the arrow notation `->` to quickly do the first option
- The arrow notation is probably the cleaner and quicker method
- When we pass struct values into functions (such as `modify1`), they are copied
-
This means any changes we make to that struct are not reflected in the original struct
- When we pass struct pointers into functions (such as `modify2`), the original struct may be modified -Since we have a pointer, we can go to the location of the struct and modify that struct