1#define _GNU_SOURCE 2#include <stdio.h> 3#include <stdlib.h> 4 5char* gcvt(double x, int n, char* b) { 6 sprintf(b, "%.*g", n, x); 7 return b; 8} 9