Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (43 sloc) 773 Bytes
struct B {
int k;
}
struct nestedstruct {
int a;
int b;
B c;
}
struct value {
int x;
int y;
nestedstruct n;
}
void main() {
print("1..9\n");
value v = new value();
v.x = 1;
v.y = 2;
v.n = new nestedstruct();
v.n.c = new B();
v.n.a = 5;
v.n.b = 6;
foo(v);
print("ok ", v.x, "\n");
print("ok ", v.y, "\n");
print("ok ", v.n.a, "\n");
print("ok ", v.n.b, "\n");
bar(v.n);
v.n.c.k = 9;
print("ok ", v.n.a, "\n");
print("ok ", v.n.b, "\n");
print("ok ", v.n.c.k, "\n");
}
void foo(value v) {
print("ok ", v.x, "\n");
print("ok ", v.y, "\n");
v.x = 3;
v.y = 4;
}
void bar(nestedstruct m) {
m.a = 7;
m.b = 8;
}