From f3209584a3ae22afc84f2bde6899e248bc86a154 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Wed, 12 Oct 2016 17:51:36 +0100 Subject: Add Pointer Arithmetic --- code/demo.odin | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'code') 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) } -- cgit v1.2.3