Ok, here is the example on how to convert a number into equivalent string

It’s not exactly hard to do without any function. All you have to do is extract one number at a time from the whole number and put it into string.

Here you will encounter two problems…

  1. Extracted number can not be assigned directly into string
  2. You can extract the last digit from the whole number so in string you will have shift the numbers each time you add new one

Solution goes as below…

void Int2Str(char* num, int number)
{
int i;
int j;

for(i = 0; number > 0; i++)
{

/* Before assigning, add 48 to the extracted digit so the value will be truned into      ASCII value of equivalent digit since ASCII of digit 0 is 48 */
num[0] = (number % 10) + 48;
number = number / 10;       /* Remove the extracted digit */

/* If the whole number has more than 1 digit then you will need to shift each digit one location to right to make place for new coming digit, otherwise number you get will be reversed */
if ( number != 0)
{
for (j = i + 1; j > 0; j–)
num[j] = num[j – 1];
}
}
num[i] = ‘\0’;      /*Finally, end with the marking that marks the end ^_^*/

}

All done!!!!