mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-07 05:30:43 +00:00
working on struct strategy
This commit is contained in:
parent
cff815f5d7
commit
56fdce0d5c
24
src/test/kc/struct-11b.kc
Normal file
24
src/test/kc/struct-11b.kc
Normal file
@ -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();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user