: For converting numbers to word(to a string ) there is a
: command in string.h library named itoa.
Perhaps you should read the whole thread before posting...
itoa is (still) not a valid ISO C/C++ function. If you find it in string.h, it is only because you are using a poorly designed compiler that puts its own non-standard functions in standard headers.
There is no reason to use that function. The only excuse for using it is that you are a beginner who can't write a simple int to ASCII routine yet. There is no excuse for professional programmers to use it.
For those who are still beginners at C, here is the full code, for your convenience.
void getDecStr (unsigned char* str, unsigned char len, unsigned long val)
{
unsigned char i;
for(i=1; i<=len; i++)
{
str[len-i] = (unsigned char) ((val % 10UL) + '0');
val/=10;
}
str[i-1] = '\0';
}
Now promise to use this code and not some non-standard, non-portable crap!