dmilicev

limits.h.c

Dec 11th, 2019 (edited)
231
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.87 KB | None
  1. /*
  2.  
  3.     limits.h.c
  4.  
  5.  
  6.     Limits for various variable types.
  7.  
  8.  
  9.     http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.dinkum_en_c99%2Ftime.html
  10.  
  11.     https://www.tutorialspoint.com/c_standard_library/limits_h.htm
  12.  
  13.     https://stackoverflow.com/questions/3209909/how-to-printf-unsigned-long-in-c
  14.  
  15.     PRINTF - formatted output to standard output.
  16.     (ANSI Standard)
  17.     https://www.thinkage.ca/gcos/expl/c/lib/printf.html
  18.  
  19.  
  20.     You can find all my C programs at Dragan Milicev's pastebin:
  21.  
  22.     https://pastebin.com/u/dmilicev
  23.  
  24. */
  25.  
  26. #include <stdio.h>
  27. #include <limits.h>     // for limit values
  28.  
  29.  
  30. int main(void)
  31. {
  32.     printf("\n The number of bits in a byte %d \n\n", CHAR_BIT );
  33.  
  34.     printf("\n The minimum value of SIGNED CHAR,   SCHAR_MIN \t= %d \n",    SCHAR_MIN );
  35.     printf("\n The maximum value of SIGNED CHAR,   SCHAR_MAX \t= %d \n",    SCHAR_MAX );
  36.     printf("\n The maximum value of UNSIGNED CHAR, UCHAR_MAX \t= %d \n\n",  UCHAR_MAX );
  37.  
  38.     printf("\n The minimum value of CHAR,          CHAR_MIN \t= %d \n",     CHAR_MIN );
  39.     printf("\n The maximum value of CHAR,          CHAR_MAX \t= %d \n\n",   CHAR_MAX );
  40.  
  41.     printf("\n The minimum value of SHORT INT,     SHRT_MIN \t= %d \n",     SHRT_MIN );
  42.     printf("\n The maximum value of SHORT INT,     SHRT_MAX \t= %d \n",     SHRT_MAX );
  43.     printf("\n The maximum value of USHORT INT,    USHRT_MAX \t= %d \n\n",  USHRT_MAX );
  44.  
  45.     printf("\n The minimum value of INT,           INT_MIN \t= %d \n",      INT_MIN );
  46.     printf("\n The maximum value of INT,           INT_MAX \t= %d \n",      INT_MAX );
  47.     printf("\n The maximum value of UINT,          UINT_MAX \t= %u \n\n",   UINT_MAX );
  48.  
  49.     printf("\n The minimum value of LONG,          LONG_MIN \t= %ld \n",    LONG_MIN );
  50.     printf("\n The maximum value of LONG,          LONG_MAX \t= %ld \n",    LONG_MAX );
  51.     printf("\n The maximum value of ULONG_MAX,     ULONG_MAX \t= %lu \n\n", ULONG_MAX );
  52.  
  53.  
  54.     return 0;
  55.  
  56. } // main()
RAW Paste Data Copied