Call a foreign-language function: Difference between revisions

Added Zig
m (→‎{{header|Phix}}: added syntax colouring, marked p2js incompatible)
(Added Zig)
Line 3,262:
Goodbye, World!
</pre>
 
=={{header|Zig}}==
<lang zig>const std = @import("std");
const c = @cImport({
@cInclude("stdlib.h"); // `free`
@cInclude("string.h"); // `strdup`
});
 
pub fn main() !void {
const string = "Hello World!";
var copy = c.strdup(string);
 
try std.io.getStdOut().writer().print("{s}\n", .{copy});
c.free(copy);
}</lang>
 
=={{header|zkl}}==
22

edits