Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The maximum value of "unsigned long int" in c++

How can I know what is the maximum assignable value for a variable from the the type of "unsigned long int"?

like image 801
user2517676 Avatar asked Aug 18 '13 17:08

user2517676


People also ask

What is the maximum value for unsigned long?

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).

What is the value of Ulong_max?

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).

What is Uint_max in C?

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*


1 Answers

The obvious way would be to use std::numeric_limits<unsigned long>::max();

like image 73
Jerry Coffin Avatar answered Sep 20 '22 14:09

Jerry Coffin