zig/example/hello_world/hello_libc.zig
Andrew Kelley 4bf149795a update hello world examples
edge cases matter

See #510
2017-10-01 12:40:30 -04:00

14 lines
246 B
Zig

const c = @cImport({
@cInclude("stdio.h");
@cInclude("string.h");
});
const msg = c"Hello, world!\n";
export fn main(argc: c_int, argv: &&u8) -> c_int {
if (c.printf(msg) != c_int(c.strlen(msg)))
return -1;
return 0;
}