I am porting a small C helper to Zig. In C I wrote int scale(int v) { v *= 2; return v; } and changed the parameter freely. The Zig version fn scale(value: u32) u32 { value *= 2; return value; } does not compile: the compiler says it cannot assign to a constant.
Why are parameters constant in Zig, and what is the idiomatic way to either work on a copy or actually change the caller's variable? I also have a configuration struct of about 4 kB that I want a function to update in place.




