From 19c70b8eaa1126f1648b009d99092432a5c88059 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 1 Sep 2017 18:14:43 +0200 Subject: Structs + typedefs --- struct.lang | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 struct.lang (limited to 'struct.lang') diff --git a/struct.lang b/struct.lang new file mode 100644 index 0000000..3297939 --- /dev/null +++ b/struct.lang @@ -0,0 +1,19 @@ +type S := struct { + int x; + char y; +}; + +func f(int iets1, S s, int iets2) { + putint(s.x); putc(s.y); putc('\n'); + putint(iets1); putc(' '); putint(iets2); putc('\n'); +} + +func int main() { + int a := getc(); + int b := getc(); + getc(); // newline + S ding := {x = 2*a, y = 'a'}; + // return ding.x; + f(123, ding, 456); + return int(ding.y) + a + b; +} -- cgit v1.2.3-70-g09d2