1 /*2 inttostr: Converting integer data to Strings3 */4 5#include <stdio.h>6 7 8 voidINT_TO_STR (ConstUnsignedLong intI_number,Char*str);9 Ten intMainintargcChar*argv[]) One { AUnsignedLong inti_test; - Charstr[ -]; - thei_test=1234567; - int_to_str (I_TEST,STR); - - puts (str); + - return 0; + } A at /* - function Function: - converts an integer number to a string consisting of 0-9 characters - For example: - will 123--> "123" - function Prototypes: in void Int_to_str (const unsigned long int i_number, char *str) - function Parameters: to const unsigned long int i_number: integer value to convert + char *str: Used to store converted strings - Exception: the */ * $ voidINT_TO_STR (ConstUnsignedLong intI_number,Char*str)Panax Notoginseng { -UnsignedLong inti_temp; the Char*P_char_head; + Char*p_char_temp; A Charchar_temp; the +i_temp=I_number; -P_char_head=str; $p_char_temp=str; $ - while(Ten<i_temp) - { the* (p_char_temp++) = (i_temp%Ten) +'0'; -I_temp/=Ten;Wuyi } the* (p_char_temp) =i_temp +'0'; -* (++p_char_temp) =' /'; Wu--p_char_temp; - About while(P_char_temp >p_char_head) $ { -char_temp=*(p_char_temp); -* (p_char_temp--) =*(p_char_head); -* (p_char_head++) =char_temp; A } + the}
"Algorithms and data Structures" _16_ small algorithm _inttostr: converting integer data to Strings