aboutsummaryrefslogtreecommitdiff
path: root/struct.lang
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-09-01 18:14:43 +0200
committertomsmeding <tom.smeding@gmail.com>2017-09-01 18:15:25 +0200
commit19c70b8eaa1126f1648b009d99092432a5c88059 (patch)
treebd4171a4d6ef5e8ae2b09e1c84bf3e2346374e97 /struct.lang
parent3d5d85e00f2a81efb62bb17f8e5db63fe5a49a61 (diff)
Structs + typedefs
Diffstat (limited to 'struct.lang')
-rw-r--r--struct.lang19
1 files changed, 19 insertions, 0 deletions
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;
+}