about summary refs log tree commit diff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/18.src16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/18.src b/examples/18.src
new file mode 100644
index 0000000..90234c4
--- /dev/null
+++ b/examples/18.src
@@ -0,0 +1,16 @@
+extern printf = (*i64, varargs) => void;
+extern malloc = (i64) => *i64;
+extern free = (*i64) => void;
+
+let main = () => i64 {
+	let x = malloc(128);
+	/*
+	*(x+0) = 10;
+	*(x+8) = 20;
+	*/
+	printf("%p\n", x);
+	printf("%d\n", *x);
+	printf("%d\n", *(x+1));
+	free(x);
+	return 0;
+};