Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING HTML & CSS BASH RUST TOOLS

C Tutorial

C HOME C Intro C Get Started C Syntax C Output C Comments C Variables C Data Types C Type Conversion C Constants C Operators C Booleans C If...Else C Switch C While Loop C For Loop C Break/Continue C Arrays C Strings C User Input C Memory Address C Pointers

C Functions

C Functions C Function Parameters C Pass By Reference C Scope C Function Declaration C Functions Challenge C Math Functions C Inline Functions C Recursion C Function Pointers

C Files

C Create Files C Write To Files C Read Files

C Structures

C Structures C Structs Challenge C Nested Structures C Arrays of Structs C Structs & Pointers C Unions C typedef C Struct Padding

C Enums

C Enums

C Memory

C Memory Management C Allocate Memory C Access Memory C Reallocate Memory C Deallocate Memory C Structs and Memory C Memory Example C Memory Mistakes

C Errors

C Errors C Error Challenge C Debugging C NULL C Error Handling C Input Validation

C Problem Solving

C Problem Solving C Build the Logic C Edge Cases & Errors C Test Cases

C Projects

C Projects

C More

C Date C Random Numbers C Macros C Organize Code C Storage Classes C Bitwise Operators C Fixed-width Integers C Command-Line Args

C DSA

C DSA Intro C Searching C Sorting C Stacks C Queues C Linked Lists C Trees C Hash Tables C Big O

C Cert

C Certificate

C Examples

C Examples C Real-Life Examples C Exercises C Quiz C Code Challenges C Practice Problems C Compiler C Syllabus C Study Plan C Interview Q&A

C Reference

C Reference C Keywords C Preprocessor C <assert.h> C <ctype.h> C <errno.h> C <limits.h> C <math.h> C <stdbool.h> C <stddef.h> C <stdint.h> C <stdio.h> C <stdlib.h> C <string.h> C <time.h>

C limits (limits.h) Library


Share

C limits Constants

The <limits.h> header has constants with the smallest and largest values that each integer type can store.

Example

Print the smallest and largest values of an int:

printf("%d\n", INT_MIN);
printf("%d\n", INT_MAX);

Try it Yourself »

The values can be different on different systems. The table shows the values on most computers today:

Constant Description Value
CHAR_BIT The number of bits in a char (one byte) 8
SCHAR_MIN The smallest value of signed char -128
SCHAR_MAX The largest value of signed char 127
UCHAR_MAX The largest value of unsigned char 255
CHAR_MIN The smallest value of char -128 or 0
CHAR_MAX The largest value of char 127 or 255
SHRT_MIN The smallest value of short -32768
SHRT_MAX The largest value of short 32767
USHRT_MAX The largest value of unsigned short 65535
INT_MIN The smallest value of int -2147483648
INT_MAX The largest value of int 2147483647
UINT_MAX The largest value of unsigned int 4294967295
LONG_MIN The smallest value of long -2147483648 (4 bytes) or -9223372036854775808 (8 bytes)
LONG_MAX The largest value of long 2147483647 (4 bytes) or 9223372036854775807 (8 bytes)
ULONG_MAX The largest value of unsigned long 4294967295 (4 bytes) or 18446744073709551615 (8 bytes)
LLONG_MIN The smallest value of long long -9223372036854775808
LLONG_MAX The largest value of long long 9223372036854775807
ULLONG_MAX The largest value of unsigned long long 18446744073709551615

Note: The smallest value of an unsigned type is always 0, so there is no UINT_MIN.

C float.h Constants

The <float.h> header has constants for the decimal types float and double.

Example

Print how many digits float and double can store correctly:

printf("%d\n", FLT_DIG);
printf("%d\n", DBL_DIG);

Try it Yourself »

Constant Description Value
FLT_DIG The number of decimal digits that a float stores correctly 6
FLT_EPSILON The difference between 1 and the next float value 1.192093e-07
FLT_MIN The smallest positive normal float value 1.175494e-38
FLT_MAX The largest float value 3.402823e+38
DBL_DIG The number of decimal digits that a double stores correctly 15
DBL_EPSILON The difference between 1 and the next double value 2.220446e-16
DBL_MIN The smallest positive normal double value 2.225074e-308
DBL_MAX The largest double value 1.797693e+308

Note: <float.h> has the same constants for long double, with LDBL_ in front, like LDBL_MAX.



Related Pages

Read more about data types in our C Data Types Tutorial and C Decimal Precision Tutorial.


Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.