this might not really be a MySQL question and I might not remember my C as good as I should, but here goes: you set intArray to 0. The sprintf() function scans the supplied argument, byteArray, which will contain a zero byte first. This is what sprintf() consider to be "end of string". All str* functions behave this way, since a byte with value of 0 denotes "end of string". In this particular case, sprintf() will (correctly) interpret your supplied "string" as the empty string.