#include #include #include #define BLUE "\e[31m" #define RESET "\e[0m" void print_(const char *msg, const double *val, const int len) { char *nullmsg = malloc(len + 1); if( nullmsg == NULL ) { fputs("Out of memory in " __FILE__, stderr); exit(1); } strncpy(nullmsg, msg, len); printf("%s" BLUE "%g" RESET "\n", nullmsg, *val); free(nullmsg); }