In the C language, how do I convert unsigned long value to a string (char *) and keep my source code portable or just recompile it to work
const int n = snprintf(NULL, 0, "%lu", ulong_value); assert(n > 0); char buf[n+1]; int c = snprintf(buf, n+1, "%lu", ulong_value); assert(buf[n] == '\0'); assert(c == n);