mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
20 lines
252 B
Plaintext
20 lines
252 B
Plaintext
import std;
|
|
struct Foo
|
|
{
|
|
int a,b,c,d;
|
|
}
|
|
|
|
fn void pointer_diff() @test
|
|
{
|
|
Foo* foo;
|
|
isz offset = &foo[1] - &foo[0];
|
|
assert(offset == 1);
|
|
}
|
|
|
|
fn void pointer_add() @test
|
|
{
|
|
Foo* foo;
|
|
Foo* bar = foo + 2;
|
|
isz offset = bar - foo;
|
|
assert(offset == 2);
|
|
} |