# Runtime-mutating and passing around '\[\]const u8' character strings

**URL:** <https://ziggit.dev/t/runtime-mutating-and-passing-around-const-u8-character-strings/3186>\
**Category:** Help\
**Tags:** memory-management, compiler\
**Created:** [February 9, 2024, 3:11pm UTC](https://ziggit.dev/t/runtime-mutating-and-passing-around-const-u8-character-strings/3186 "2024-02-09T15:11:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![IntegratedQuantum](https://ziggit.dev/user_avatar/ziggit.dev/integratedquantum/32/782_2.png) [@IntegratedQuantum](https://ziggit.dev/u/IntegratedQuantum)\
**Post date:** [February 9, 2024, 3:38pm UTC](https://ziggit.dev/t/runtime-mutating-and-passing-around-const-u8-character-strings/3186/2 "2024-02-09T15:38:30Z")

</div>

> [@FObersteiner](#):
>
> But how is this done for runtime variables? A string of characters isn’t a fixed number of bytes, so how is this implemented?

Generally you are the one to decide where the string is stored. You can either store it in a buffer on the stack(be careful with lifetimes here!), or you need to allocate the string using some allocator(don’t forget to free it afterwards!).

> [@FObersteiner](#):
>
> Any ideas what I’m doing wrong here?

Judging by the behavior you are getting I would guess that you are triggering some form of undefined behavior. One possible problem might be [Pointers to Temporary Memory](https://ziggit.dev/t/pointers-to-temporary-memory/3177).

---

_[View the full topic](https://ziggit.dev/t/runtime-mutating-and-passing-around-const-u8-character-strings/3186)._
