#How do I create a struct out of array members for printing?

1 messages · Page 1 of 1 (latest)

chilly hound
#

I want to print the integer array { 1, 2, 3 } like this:

std.debug.print("{d}, {d}, {d}\n", .{???});

what should i write instead of ??? (there are 32 elements in the array i want to print and i created the format string using ++ and **)

frank bay
#

you can just put the array in there with a single corresponding format specifier

#

std.debug.print("{d}", .{arr})

chilly hound
#

i have a custom format in which i want to print it though with some text in the middle of elements etc

frank bay
#

you can add a format function in your struct and itll use that when printing the struct

chilly hound
#

o i'll look into this thanks