-
-
Save kbd/a344a3202fbc3d51935e3821a7797dd4 to your computer and use it in GitHub Desktop.
This file contains 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 characters
const std = @import("std"); | |
const print = std.debug.print; | |
const Allocator = std.mem.Allocator; | |
pub fn main() !void { | |
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
defer arena.deinit(); | |
var A = &arena.allocator; | |
var a1 = [_][]const u8{ "a", "b", "c" }; | |
var a2 = [_][]const u8{ "d", "e", "f" }; | |
var a3 = try std.mem.concat(A, u8, &[_][][]const u8{ a1, a2 }); | |
print("a3: {}", .{a3}); | |
} |
Author
kbd
commented
Jan 18, 2021
var a3 = try std.mem.concat(A, u8, &[_][][]const u8{ &a1, &a2 });
gives:
$ zig run scratch.zig
./scratch.zig:11:5: error: expected type '[]const u8', found '*[3][]const u8'
var a1 = [_][]const u8{ "a", "b", "c" };
^
./scratch.zig:13:57: note: referenced here
var a3 = try std.mem.concat(A, u8, &[_][]const u8{ &a1, &a2 });
^
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment