How can I know what is the maximum assignable value for a variable from the the type of "unsigned long int"?
Description. Unsigned long variables are extended size variables for number storage, and store 32 bits (4 bytes). Unlike standard longs unsigned longs won't store negative numbers, making their range from 0 to 4,294,967,295 (2^32 - 1).
ULONG_MAX constant is a macro constant which is defied in climits header, it is used to get the maximum value of an unsigned long int object, it returns the maximum value that an unsigned long int object can store, which is 18446744073709551615 (on 32 bits compiler).
UINT_MAX : Maximum value for an object of type unsigned int Value of UINT_MAX is 65535 (216-1) or greater* 9. LONG_MIN : Minimum value for an object of type long int Value of LONG_MIN is -2147483647 (-231+1) or less*
The obvious way would be to use std::numeric_limits<unsigned long>::max();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With