aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-10-12 17:51:36 +0100
committerGinger Bill <bill@gingerbill.org>2016-10-12 17:51:36 +0100
commitf3209584a3ae22afc84f2bde6899e248bc86a154 (patch)
tree603caa5452dbd3b03ea0b7f6b3cf352f9ad640f4 /code
parentf5318c46d13ed3f3de20e0f61c4193e6ad46a42b (diff)
Add Pointer Arithmetic
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin10
1 files changed, 10 insertions, 0 deletions
diff --git a/code/demo.odin b/code/demo.odin
index 29a96fbb9..9a4d522cc 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -1,5 +1,15 @@
#import "fmt.odin"
main :: proc() {
+ Vec3 :: struct {
+ x, y: i16
+ z: ?i32
+ }
+ a := [..]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
+ offset: u8 = 2
+ ptr := ^a[4]
+
+
+ fmt.println((ptr+offset) - ptr)
}