Skip to content

Commit

Permalink
tutorial: Improve get_point() example explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli authored Dec 30, 2024
1 parent 63af4d0 commit 703ad2e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ def main() -> int:
return 0
```

Here `x: int` creates an integer variable `x` without assigning a value to it.
This means that we leave 4 bytes of the computer's memory unused for now.
We then pass the location of that memory to `get_point()`,
so that it can write to that memory, i.e. set the value of the `x` variable.

Instead of pointers, you could also use an `int[2]` array to return the two values:

```python
Expand Down

0 comments on commit 703ad2e

Please sign in to comment.