mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
20 lines
275 B
Plaintext
20 lines
275 B
Plaintext
module test;
|
|
import libc;
|
|
|
|
<*
|
|
@require values::@assign_to(*b, *a) && values::@assign_to(*a, *b)
|
|
*>
|
|
macro void @swap(&a, &b)
|
|
{
|
|
var temp = *a;
|
|
*a = *b;
|
|
*b = temp;
|
|
}
|
|
|
|
fn void main()
|
|
{
|
|
int x = 123;
|
|
int y = 456;
|
|
@swap(x, y);
|
|
libc::printf("x: %d y: %d\n", x, y);
|
|
} |