Question: What does this fragment of code do? Comment where needed and describe the overall functionality. Hint: the name of the function gives a clue. void

What does this fragment of code do? Comment where needed and describe the overall functionality. Hint: the name of the function gives a clue.

void itoa (int n, char s[])

{

int i, sign;

if ((sign = n) < 0)

n = -n;

i = 0;

do {

s[i++] = n %10 + '0';

} while ((n/= 10) > 0);

if (sign < 0)

s[i++] = '-';

s[i] = '\0';

reverse (s); /* reverses the string */

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!