mirror of
https://github.com/ziglang/zig.git
synced 2024-11-28 08:02:32 +00:00
19 lines
173 B
Zig
19 lines
173 B
Zig
|
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
|
||
|
//
|