Created
December 10, 2024 06:32
-
-
Save 50n1cd347h9/ec1152ac10484a248477bcbbcec788f2 to your computer and use it in GitHub Desktop.
Revisions
-
50n1cd347h9 created this gist
Dec 10, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ ```zig const std = @import("std"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const a = gpa.allocator(); const hoge_str = try a.dupe(u8, "hogehoge"); defer a.free(hoge_str); std.debug.print("{s}\n", .{hoge_str}); } ``` output ```txt $ zig run dupe.zig hogehoge ```