about summary refs log tree commit diff
path: root/examples/18.src
blob: 6d75e3033a3f3ae90fd808bf38e80600adb569bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern printf = (*i64, varargs) => void;
extern malloc = (i64) => *i64;
extern free = (*i64) => void;

let main = () => i64 {
	let x = malloc(128);
	(*(x+0)) = 10;
	(*(x+1)) = 20;
	(*(x+2)) = 40;
	printf("%p\n", x);
	printf("%d\n", *(x+0));
	printf("%d\n", *(x+1));
	printf("%d\n", *(x+2));
	free(x);
	return 0;
};