Is there a way to evaluate an expression before stringification in c?
example:
#define stringify(x) #x ... const char * thestring = stringify( 10 *
The C preprocessor cannot do that, so use snprintf instead:
snprintf
char *stringify(int n) { char *res = malloc(12); snprintf(res, 12, "%d", n); return res; }
const char *thestring = stringify(10 * 50);
For simplicity's sake I've omitted error control and free.
free