CS153/hw6/hw5programs/ifq4.oat

17 lines
248 B
Text
Raw Normal View History

struct S { int x; int y }
int sum(S? s) {
if?(S x = s) {
return x.x;
} else {
return 0;
}
}
int program (int argc, string[] argv) {
var x = 0;
x = x + sum(S null);
x = x + sum(new S{x=4; y=5});
return x;
}