122. Data Conversion and Encoding-ii

Question.2

A developer writes a custom integer-to-string function using the modulo-divide method:

void my_itoa(int num, char *str) {
    int i = 0;
    while (num > 0) {
        str[i++] = (num % 10) + '0';
        num /= 10;
    }
    str[i] = '\0';
    reverse(str);
}

He calls:

my_itoa(-42, buf);
printf("%s", buf);

What does this produce?

Need Help? Refer to the Quick Guide below

Select Answer