Dec 21, 2011

K & R C Programs Exercise 2-1.

K and R C, Solution to Exercise 2-1:
C program to determine the ranges of char, short, int and long variables, both signed and unsigned, by printing appropriate values from standard headers and by direct computation.the ANSIstandard for C specifies that ranges be defined in <limits.h>. K and R C Program. Exercises provides the solution to all the exercises in the C Programming Language, second addition, by Brian W.Keringhan and Dennis M.Ritchie(Prentice Hall,1988). You can learn and solve K&R C Programs Exercise. Read more about C Programming Language .
* You can use all the programs on
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact
* To find more C programs, do visit
* and browse!
*                      Happy Coding

#include <stdio.h>
#include <limits.h>

main ()
 printf("Range of Char %d\n", CHAR_BIT);
 printf("Range of Char Max %d\n", CHAR_MAX);
 printf("Range of Char Min %d\n", CHAR_MIN);
 printf("Range of int min %d\n", INT_MIN);
 printf("Range of int max %d\n", INT_MAX);
 printf("Range of long min %ld\n", LONG_MIN);       
 printf("Range of long max %ld\n", LONG_MAX);       
 printf("Range of short min %d\n", SHRT_MIN);
 printf("Range of short max %d\n", SHRT_MAX);
 printf("Range of unsigned char %u\n", UCHAR_MAX);  
 printf("Range of unsigned long %lu\n", ULONG_MAX); 
 printf("Range of unsigned int %u\n", UINT_MAX);    
 printf("Range of unsigned short %u\n", USHRT_MAX);

 return 0;

Read more Similar C Programs
C Basic

K and R C Programs Exercise
You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!
To browse more C Programs visit this link