# climits

***

**1. Checking Size of Integer Types**

```cpp
#include <climits>

int main() {
  // Print the minimum and maximum values of different integer types
  std::cout << "int: " << INT_MIN << " to " << INT_MAX << std::endl;
  std::cout << "short: " << SHRT_MIN << " to " << SHRT_MAX << std::endl;
  std::cout << "long: " << LONG_MIN << " to " << LONG_MAX << std::endl;
  std::cout << "long long: " << LLONG_MIN << " to " << LLONG_MAX << std::endl;
  return 0;
}
```

**2. Checking Size of Float Types**

```cpp
#include <climits>

int main() {
  // Print the minimum and maximum values of float and double
  std::cout << "float: " << FLT_MIN << " to " << FLT_MAX << std::endl;
  std::cout << "double: " << DBL_MIN << " to " << DBL_MAX << std::endl;
  return 0;
}
```

**3. Checking Floating-Point Precision**

```cpp
#include <climits>
#include <iostream>

using namespace std;

int main() {
  // Print the number of significant digits in float and double
  cout << "float precision: " << FLT_DIG << endl;
  cout << "double precision: " << DBL_DIG << endl;
  return 0;
}
```

**4. Checking Integer Overflow and Underflow**

```cpp
#include <climits>

int main() {
  int x = INT_MAX;
  int y = x + 1;  // Integer overflow

  if (y < x) {
    std::cout << "Integer overflow occurred!" << std::endl;
  }

  x = INT_MIN;
  y = x - 1;  // Integer underflow

  if (y > x) {
    std::cout << "Integer underflow occurred!" << std::endl;
  }
  return 0;
}
```

**5. Checking Floating-Point Overflow and Underflow**

```cpp
#include <climits>
#include <iostream>

using namespace std;

int main() {
  double x = DBL_MAX;
  double y = x * 2;  // Floating-point overflow

  if (isinf(y)) {
    cout << "Floating-point overflow occurred!" << endl;
  }

  x = DBL_MIN;
  y = x / 2;  // Floating-point underflow

  if (y == 0) {
    cout << "Floating-point underflow occurred!" << endl;
  }
  return 0;
}
```

**6. Checking Minimum and Maximum Digits**

```cpp
#include <climits>

int main() {
  // Print the minimum and maximum number of digits in a signed integer
  std::cout << "Minimum digits: " << CHAR_MIN << std::endl;
  std::cout << "Maximum digits: " << CHAR_MAX << std::endl;
  return 0;
}
```

**7. Checking Sizes of Other Types**

```cpp
#include <climits>

int main() {
  // Print the sizes of other data types
  std::cout << "Size of bool: " << sizeof(bool) << " bytes" << std::endl;
  std::cout << "Size of char: " << sizeof(char) << " bytes" << std::endl;
  std::cout << "Size of short: " << sizeof(short) << " bytes" << std::endl;
  return 0;
}
```

**8. Checking Precision of Long Double**

```cpp
#include <climits>
#include <iostream>

using namespace std;

int main() {
  // Print the precision of long double
  cout << "Long double precision: " << LDBL_DIG << endl;
  return 0;
}
```

**9. Checking Maximum Integer Divisor**

```cpp
#include <climits>

int main() {
  // Print the maximum integer divisor
  std::cout << "Maximum integer divisor: " << INT_MAX / INT_MAX << std::endl;
  return 0;
}
```

**10. Checking Maximum Float Divisor**

```cpp
#include <climits>

int main() {
  // Print the maximum float divisor
  std::cout << "Maximum float divisor: " << FLT_MAX / FLT_MAX << std::endl;
  return 0;
}
```

**11. Checking Maximum Double Divisor**

```cpp
#include <climits>

int main() {
  // Print the maximum double divisor
  std::cout << "Maximum double divisor: " << DBL_MAX / DBL_MAX << std::endl;
  return 0;
}
```

**12. Checking Signed and Unsigned Integer Sizes**

```cpp
#include <climits>

int main() {
  // Print the sizes of signed and unsigned integers
  std::cout << "Size of signed int: " << sizeof(int) << " bytes" << std::endl;
  std::cout << "Size of unsigned int: " << sizeof(unsigned int) << " bytes" << std::endl;
  return 0;
}
```

**13. Checking Maximum Size of an Array**

```cpp
#include <climits>

int main() {
  // Print the maximum size of an array
  std::cout << "Maximum size of an array: " << INT_MAX / sizeof(int) << std::endl;
  return 0;
}
```

**14. Checking Minimum and Maximum Bits**

```cpp
#include <climits>

int main() {
  // Print the minimum and maximum number of bits
  std::cout << "Minimum bits: " << CHAR_BIT << std::endl;
  std::cout << "Maximum bits: " << sizeof(int) * CHAR_BIT << std::endl;
  return 0;
}
```

**15. Checking Maximum and Minimum Characters**

```cpp
#include <climits>

int main() {
  // Print the maximum and minimum characters
  std::cout << "Minimum char: " << CHAR_MIN << std::endl;
  std::cout << "Maximum char: " << CHAR_MAX << std::endl;
  return 0;
}
```

**16. Checking Unsigned Integer Comparison**

```cpp
#include <climits>

int main() {
  // Compare two unsigned integers
  unsigned int a = UINT_MAX;
  unsigned int b = UINT_MAX - 1;

  if (a > b) {
    std::cout << "a is greater than b" << std::endl;
  } else {
    std::cout << "a is not greater than b" << std::endl;
  }
  return

```
