to_string

Run Settings
LanguageC++
Language Version
Run Command
#include <stdio.h> #include <stdlib.h> #include <assert.h> #define to_string(...) \ to_string_write_and_return_ptr_( \ (char *)alloca(snprintf(0,0,__VA_ARGS__) + 1), \ __VA_ARGS__) char *to_string_write_and_return_ptr_(char *to_buffer, char *format, ...) { assert(to_buffer); va_list args; va_start(args, format); vsnprintf(to_buffer, 0xffffffff, format, args); va_end(args); return to_buffer; } int main() { char *c = to_string("ab %f cd %i", 32.0, 91); printf(c); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines