From bd42f4899d09c8f6317ae1af1747ae5b6ac81650 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sun, 6 Apr 2025 16:17:22 +0200 Subject: Feature: Add char type and support underlying pointer values --- examples/19.src | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/19.src (limited to 'examples') diff --git a/examples/19.src b/examples/19.src new file mode 100644 index 0000000..2aa5dd7 --- /dev/null +++ b/examples/19.src @@ -0,0 +1,23 @@ +extern printf = (*i64, varargs) => void; +extern malloc = (i64) => *i8; +extern free = (*i64) => void; + +let main = () => i64 { + let buf = malloc(13); + (*(buf+0)) = 'h'; + (*(buf+1)) = 'e'; + (*(buf+2)) = 'l'; + (*(buf+3)) = 'l'; + (*(buf+4)) = 'o'; + (*(buf+5)) = ' '; + (*(buf+6)) = 'w'; + (*(buf+7)) = 'o'; + (*(buf+8)) = 'r'; + (*(buf+9)) = 'l'; + (*(buf+10)) = 'd'; + (*(buf+11)) = '\n'; + (*(buf+12)) = '\0'; + printf("%s", buf); + free(buf); + return 0; +}; -- cgit 1.4.1