#include #include #define V(x) {x, #x} struct constant { double value; const char * name; } constants[] = { V (M_E), V (M_LOG2E), V (M_LOG10E), V (M_LN2), V (M_LN10), V (M_PI), V (M_PI_2), V (M_PI_4), V (M_1_PI), V (M_2_PI), V (M_2_SQRTPI), V (M_SQRT2), V (M_SQRT1_2), V (HUGE), V (MAXFLOAT), V (HUGE_VAL), }; int n_constants = sizeof (constants) / sizeof (struct constant); int main () { int i; for (i = 0; i < n_constants; i++) { printf ("%s: %g\n", constants[i].name, constants[i].value); } return 0; }