Jump to content

limits.h

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 65.242.84.196 (talk) at 15:26, 10 December 2007 (Fixed all of the inaccuracies). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

limits.h is the header of the general purpose standard library of C programming language which includes definitions of the characteristics of variable types. The values are implementation specific, but may not be of lower magnitude than certain specified values in a conforming C implementation.

Member constants

Name Description Minimum value*
CHAR_BIT Number of bits in a byte +8
SCHAR_MIN Minimum value for a signed char -128
SCHAR_MAX Maximum value for a signed char +127
UCHAR_MAX Maximum value for an unsigned char +255
CHAR_MIN Minimum value for a char -128 (if char is represented as a signed char; otherwise 0)
CHAR_MAX Maximum value for a char +127 (if char is represented as a signed char; otherwise +255)
MB_LEN_MAX Maximum multi byte length of a character across all locales +127
SHRT_MIN Minimum value for a short int -32,768
SHRT_MAX Maximum value for a short int +32,767
USHRT_MAX Maximum value for an unsigned short int +65,535
INT_MIN Minimum value for an int -2,147,483,648
INT_MAX Maximum value for an int +2,147,483,647
UINT_MAX Maximum value for an unsigned int +4,294,967,295
LONG_MIN Minimum value for a long int -2,147,483,647
LONG_MAX Maximum value for a long int +2,147,483,647
ULONG_MAX Maximum value for an unsigned long int +4,294,967,295
LLONG_MIN Minimum value for a long long int -9,223,372,036,854,775,807
LLONG_MAX Maximum value for a long long int +9,223,372,036,854,775,807
ULLONG_MAX Maximum value for an unsigned long long int +18,446,744,073,709,551,615
  • *Notes on minimum value: The magnitude of this column is the minimum magnitude for this constant. Negative values represent the minimum value representable in one's complement and sign-magnitude forms. Most implementations will have larger magnitudes for at least some of these numbers. For example, many implementations have both INT_MAX and LONG_MAX equal to +2,147,483,647; and INT_MIN and LONG_MIN equal to -2,147,483,648. Many DSPs have CHAR_BIT equal to 16 or more[1][2].

See also

C standard library

Float.h - Limits on floating-point numbers

  • Enquire: A program for automatically generating limits.h, and for checking that the values in an existing limits.h are correct

References