On Thursday, 25 January 2024 at 15:20:01 UTC, ryuukk_ wrote:
```D
void main()
{
char[32] id = 0;
const(char)* str = "hello";
id = str[0 .. 6];
}
```
it should be a simple memcpy, why DMD complain?
``onlineapp.d(6): Error: mismatched array lengths 32 and 6 for
assignment `id[] = str[0..6]```
I'm too tired to notice something obvious?
You need to slice your `id` variable to be the required size.
You're trying to assign the complete `id` variable to a slice of
size 6.
i.e: that should be used instead `id[0..6] = str[0..6]`