You could try something like this:
#define DUMP(varname) fprintf(stderr, "%s = %x", #varname, varname);
I used to use this header I wrote, when I was new to C, it might contain some useful ideas. For example this would allow you to print a C value and provide the format specifier in one (as well as some additional information):
#define TRACE(fmt, var)
(error_at_line(0, 0, __FILE__, __LINE__, "%s : " fmt, #var, var))
If you're using C++, you could use the type of the passed value and output it appropriately. I can provide a much more lucrative example for how to "pretty print" variable values if this is the case.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…