15 lines
246 B
Zig
15 lines
246 B
Zig
|
const std = @import("std");
|
||
|
const assert = std.debug.assert;
|
||
|
|
||
|
test "dereference pointer" {
|
||
|
comptime testDerefPtr();
|
||
|
testDerefPtr();
|
||
|
}
|
||
|
|
||
|
fn testDerefPtr() void {
|
||
|
var x: i32 = 1234;
|
||
|
var y = &x;
|
||
|
y.* += 1;
|
||
|
assert(x == 1235);
|
||
|
}
|