Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to use C language to convert plastics into characters?
How to use C language to convert plastics into characters?
Use the itoa function.

Prototype: externchar * itoa (int I);

Reference code:

# include & ltstdio.h & gt

# include & ltstdlib.h & gt

int? Master ()

{

int? a = 125;

Charles? b[50];

printf("%s\n ",itoa(a,b, 10)); //Convert 125 in base 10 into characters for output.

Return? 0;

}

/*

Extended data:

Matters needing attention

The itoa () function has three parameters: the first parameter is the number to be converted, the second parameter is the target string for writing the conversion result, and the third parameter is the base used when transmitting the number. In the above example, the conversion cardinality is 10, which means that the conversion cardinality is 10. 10: decimal; 2: binary.

Itoa is not a standard C function, it is unique to Windows. If you want to write cross-platform programs, please use sprintf.

There is sprintf in the standard library, which is more powerful than this, and its usage is similar to printf:

Baidu encyclopedia -itoa function