zig/test/cases/pointers.1.zig

19 lines
173 B
Zig
Raw Normal View History

2022-04-27 21:59:55 +01:00
pub fn main() u8 {
var x: u8 = 0;
foo(&x);
bar(&x);
return x - 4;
}
fn foo(x: *u8) void {
x.* = 2;
}
fn bar(x: *u8) void {
x.* += 2;
}
// run
//