23 lines
281 B
Plaintext
23 lines
281 B
Plaintext
# Defining a structure
|
|
```c
|
|
struct Point {
|
|
int x;
|
|
int y;
|
|
int z;
|
|
}
|
|
```
|
|
|
|
# Using a structure as a variable
|
|
```rust
|
|
Point my_point { x: 0, y: 10, z: 20 };
|
|
```
|
|
|
|
# Using a structure
|
|
```rust
|
|
Point { x: 30, y: 40, z: 50 }
|
|
```
|
|
|
|
# Getting items from a structure
|
|
```rust
|
|
my_point.x
|
|
``` |