From 56fdce0d5c45b6ded1af61e761f155f41c8d44db Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sat, 14 Dec 2019 09:50:17 +0100 Subject: [PATCH] working on struct strategy --- src/test/kc/struct-11b.kc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/kc/struct-11b.kc diff --git a/src/test/kc/struct-11b.kc b/src/test/kc/struct-11b.kc new file mode 100644 index 000000000..303554cec --- /dev/null +++ b/src/test/kc/struct-11b.kc @@ -0,0 +1,24 @@ +// Example of a struct containing an array + +import "stdlib" +import "print" + +struct Person { + unsigned long id; + char[3] initials; +}; + +struct Person jesper = { 111172, "jg" }; +struct Person henry = { 280173, "hg" }; + +void main() { + print_person(jesper); + print_person(henry); +} + +void print_person(struct Person person) { + print_dword_decimal(person.id); + print_char(' '); + print_str(person.initials); + print_ln(); +} \ No newline at end of file