Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting from integer to string without using itoa(...) 2

Status
Not open for further replies.

simplythebest

Programmer
Jul 10, 2003
1
US
Pls,
can someone give me a tip on how to convert an integer to a string in C without using the itoa(...) function.

Thanks
 
If ch is a character from '0' to '9' then
ch - '0';
is the equivalent integer value
 
use
char s[32]; // the string .. declare them in any manner u
// wish .. array/malloc memory

int i = 68;
sprintf(vs, "%d", i);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top