CS153/hw5/hw5programs/tc_struct_null_field.oat
jmug 9224001a22 Update hw5 to a newer version.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
2025-01-24 21:10:31 -08:00

18 lines
225 B
Text

struct A {
int x
}
struct B {
A? a /* can be null */
}
int program(int argc, string[] args) {
var b = new B{a=A null};
b.a = new A{x = 3};
if? (A a2 = b.a) {
return a2.x;
}
b.a = A null;
return 0;
}