fork download
  1. #include <stdio.h>
  2. #include <float.h>
  3. #include <stdlib.h>
  4.  
  5. #define PR(x) printf("%11s: %2lu bytes\n", #x, (unsigned long)sizeof(x))
  6.  
  7. int main(void)
  8. {
  9. PR(size_t);
  10. PR(void *);
  11. PR(char);
  12. PR(short);
  13. PR(int);
  14. PR(long);
  15. PR(long long);
  16. PR(float);
  17. PR(double);
  18. PR(long double);
  19. printf("\n---- DIG -------EPSILON -----------MIN -----------MAX\n");
  20. printf(" FLT %3d %-14E %-14E %-14E\n", FLT_DIG, FLT_EPSILON, FLT_MIN, FLT_MAX);
  21. printf(" DBL %3d %-14E %-14E %-14E\n", DBL_DIG, DBL_EPSILON, DBL_MIN, DBL_MAX);
  22. printf("LDBL %3d %-14LE %-14LE %-14LE\n", LDBL_DIG, LDBL_EPSILON, LDBL_MIN, LDBL_MAX);
  23. printf("---- --- -------------- -------------- --------------\n");
  24. printf("RAND_MAX: %d\n", RAND_MAX);
  25. return 0;
  26. }
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
     size_t:  4 bytes
     void *:  4 bytes
       char:  1 bytes
      short:  2 bytes
        int:  4 bytes
       long:  4 bytes
  long long:  8 bytes
      float:  4 bytes
     double:  8 bytes
long double: 12 bytes

---- DIG -------EPSILON -----------MIN -----------MAX
 FLT   6 1.192093E-07   1.175494E-38   3.402823E+38  
 DBL  15 2.220446E-16   2.225074E-308  1.797693E+308 
LDBL  18 1.084202E-19   3.362103E-4932 1.189731E+4932
---- --- -------------- -------------- --------------
RAND_MAX: 2147483647