mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
16 lines
374 B
Zig
16 lines
374 B
Zig
const std = @import("std");
|
|
|
|
// This is also available as `std.c.printf`.
|
|
pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
|
|
|
|
pub fn main() anyerror!void {
|
|
_ = printf("Hello, world!\n"); // OK
|
|
|
|
const msg = "Hello, world!\n";
|
|
const non_null_terminated_msg: [msg.len]u8 = msg.*;
|
|
_ = printf(&non_null_terminated_msg);
|
|
}
|
|
|
|
// exe=build_fail
|
|
// link_libc
|