master
1const std = @import("std");
2
3// This is also available as `std.c.printf`.
4pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
5
6pub fn main() anyerror!void {
7 _ = printf("Hello, world!\n"); // OK
8
9 const msg = "Hello, world!\n";
10 const non_null_terminated_msg: [msg.len]u8 = msg.*;
11 _ = printf(&non_null_terminated_msg);
12}
13
14// exe=build_fail
15// link_libc