From: <Rap...@po...> - 2014-04-07 15:23:40
|
Quoting jgoerzen <jgo...@op...> from ml.softs.gtk-gnutella.devel: :Hello Raphael, This is the results that I get: : :% make bar :cc -o bar bar.c :"bar.c", line 4: warning: old-style declaration or incorrect type for: main :% ./bar :sizeof(float) = 4 :sizeof(double) = 8 OK, time for deeper inspection. Sorry, the program is a little bit longer but I need you to stuff it into "bar.c" and again, type "make bar" and "./bar". Thanks, Raphael -------- #include <stdio.h> #include <ctype.h> float ascii_le[] = { 3223.213134765625, 6.8273612896518898e-07, 1.9753562586009612e+31, 0 }; float ascii_be[] = { 865942.3125, 6.7652519659605424e+22, 1.9695089292781631e-07, 0 }; void show(const char *name, float x[4]) { int i; for (i = 0; i < 4; i++) { unsigned char *p = (unsigned char *) &x[i]; int j; printf("%s #%d: ", name, i); for (j = 0; j < 4; j++) { unsigned v = p[j]; printf("%u (%c) ", v, isalnum(v) ? v : '?'); } printf("\n"); } } #define SHOW(x) show(# x, x) int main() { SHOW(ascii_le); SHOW(ascii_be); return 0; } -------- |