RosettaCodeData/Task/Use-another-language-to-call-a-function/Zig/use-another-language-to-call-a-function.zig
2025-02-27 18:35:13 -05:00

11 lines
247 B
Zig

export fn Query(data: [*c]u8, length: *usize) callconv(.C) c_int {
const value = "Here I am";
if (length.* >= value.len) {
@memcpy(data[0..value.len], value);
length.* = value.len;
return 1;
}
return 0;
}