/* Gcvt (convert the float number to a string and rounding it out) related functions: ECVT, fcvt, and sprintf header file # include <stdlib. h> define the function char * gcvt (double number, size_t ndigits, char * BUF). The function indicates that gcvt () is used to convert the parameter number into an ASCII string, the ndigits parameter indicates the number of digits displayed. Gcvt () differs from ECVT () and fcvt () in that the string converted by gcvt () contains the decimal point or positive or negative sign. If the conversion is successful, the converted string will be placed in the space specified by the Buf pointer. The Return Value Returns a string pointer, which is the Buf pointer. Additional instructions */# include <stdlib. h> main () {double A = 123.45; Double B =-1234.56; char * PTR = malloc (10); int decpt, sign; gcvt (A, 5, PTR ); printf ("A value = % s \ n", PTR); PTR = gcvt (B, 6, PTR); printf ("B value = % s \ n ", PTR);}/* execute a value = 123.45b value =-1234.56 */
Gcvt (convert the float number to a string and rounding it out)