You are overwriting memory, invoking undefined behavior.
Also, itoa()
doesn't exactly create a "byte array", it creates a string. The name means "integer to ASCII". The documentation says:
The caller is responsible for providing sufficient storage [...]
Finally, a string's length is computed by strlen()
, not by sizeof
.