the variable limits : Variable « Language Basics « C / ANSI-C






the variable limits

the variable limits
/*Finding the variable limits  */
#include <stdio.h>
#include < limits.h >   /* For limits on integer types        */
#include <float.h>      /* For limits on floating-point types */

void main()
{
  printf("char store values from %d to %d", CHAR_MIN, CHAR_MAX); 
  
  printf("\n unsigned char store values from 0 to %u", UCHAR_MAX);
  
  printf("\n short store values from %d to %d", SHRT_MIN, SHRT_MAX);
  
  printf("\n unsigned short store values from 0 to %u", USHRT_MAX);
  
  printf("\n int store values from %d to %d", INT_MIN, INT_MAX);
  
  printf("\n unsigned int store values from 0 to %u", UINT_MAX);
  
  printf("\n long store values from %d to %d", LONG_MIN, LONG_MAX);
  
  printf("\n unsigned long store values from 0 to %u", ULONG_MAX);

  printf("\n\n smallest non-zero value of type float is %.3e", FLT_MIN);
  
  printf("\nThe size of the largest value of type float is %.3e", FLT_MAX);
  
  printf("\nThe size of the smallest non-zero value of type double is %.3e",
                                                        DBL_MIN);
  printf("\nThe size of the largest value of type double is %.3e", DBL_MAX);
  
  printf("\nThe size of the smallest non-zero value of type long double is %.3e",
                                                       DBL_MIN);
  printf("\nThe size of the largest value of type long double is %.3e\n",
                                                        DBL_MAX);
}



           
       








Related examples in the same category

1.demonstrate the use of variables
2.For and scanf
3.Finding the size of a typeFinding the size of a type