N
neha_chhatre
how to convert integer to char
how to convert integer to char
how to convert integer to char
how to convert integer to char
sprintf()
With a cast, e.g. (char)i is i converted to char.how to convert integer to char
how to convert integer to char
how to convert integer to char
how to convert integer to char
how to convert integer to char
how to convert integer to char
how to convert integer to char
Rui Maciel said:My oh my. September arrived later this year.
Rui Maciel
how to convert integer to char
Specify a radix and alphabet.
#define RADIX 10
char const alphabet[RADIX] =
{ '0','1','2','3','4','5','6','7','8','9' };
char UIntToChar(unsigned const i)
{
assert( i < RADIX );
return alphabet;
}
how to convert integer to char
On Oct 7, 6:26 pm, (e-mail address removed) wrote:Specify a radix and alphabet.#define RADIX 10char const alphabet[RADIX] =
{ '0','1','2','3','4','5','6','7','8','9' };char UIntToChar(unsigned const i)
{
assert( i < RADIX );return alphabet;
or this one
char inttochar(int i)
{
return i >= 0 && i <= 9 ?
i + ('1' - 1) :
i ;
}
karthikbalaguru said:1) itoa() -> converts an integer to a character array
2) cast tricks with some data loss
3) sprintf tricks w.r.t string
4) a small routine on your own
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.