Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language program answer: convert the integer n into a string and output it. ? How to write without recursion?
C language program answer: convert the integer n into a string and output it. ? How to write without recursion?
Save the int integer in the integer variable, and then use the itoa function.

Function: Converts an integer to a string.

Usage: char * itoa (int value, char * string, int root);

Itoa is an English integer of the string A (convert the integer into a string and save the value in A).

Abbreviation of. Where value is an integer to be converted, and radix is the meaning of radix, that is, first convert value into a decimal number, and then save it in.

Function: realize the conversion between number systems.

Comparison: ltoa, where l is a long integer.

Note: the header file of this function is "stdlib.h"

Program example:

# include & ltstdlib.h & gt

# include & ltstdio.h & gt

{

int main(void)

Int number =12345;

char string[25];

Itoa (number, string,10);

Printf("integer = %d string = %s\n ",number, string);

Returns 0;

}