Jump to content

limits.h

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SmackBot (talk | contribs) at 21:00, 27 November 2007 (Standard headings &/or gen fixes. using AWB). 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 -127
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 -127 (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 +1
SHRT_MIN Minimum value for a short int -32,767
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 -32,767
INT_MAX Maximum value for an int +32,767
UINT_MAX Maximum value for an unsigned int +65,535
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 use a two's complement representation, in which case the minimum value will be one less (for example, INT_MAX may be +32767 while INT_MIN is -32768).

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